Standardizing ending line breaks

Would a Glulx I/O filter be useful?

[code]Section “Preventing Multiple Contiguous Blank Lines” (for Glulx Only)

Include (-
[ set_io_system phrase;
phrase = phrase–>1;
@setiosys 1 phrase;
];
-).
To switch to printing by (P - a phrase Unicode character -> nothing): (- set_io_system({P}); -).
To add (C - a Unicode character) to the story’s output: (- glk_put_char_uni({C}); -).

To decide what Unicode character is a newline: (- 10 -).

The number of contiguous newlines recently printed is a number that varies. The number of contiguous newlines recently printed is zero.
To print (C - a Unicode character) without multiple contiguous blank lines (this is printing without multiple contiguous blank lines):
if C is a newline:
if the number of contiguous newlines recently printed is at least two:
stop;
increment the number of contiguous newlines recently printed;
otherwise:
now the number of contiguous newlines recently printed is zero;
add C to the story’s output.

A startup rule (this is the prevent multiple contiguous blank lines rule):
switch to printing by printing without multiple contiguous blank lines.

Section “Demo”

There is a room.
Instead of looking:
say “X.[line break][line break]Y.[line break][line break][line break]Z.[line break][line break][line break]”.
[/code]

1 Like