Mailing List Archive

Whitespace stripping and the blank para bug
Brion Vibber wrote:

>On ven, 2003-01-24 at 20:15, Tomasz Wegrzanowski wrote:
>
>
>>Could we append \n to article markup when we send it to client
>>in edit box ?
>>
>>All correct text files end with \n and it would make selecting
>>by mouse much easier.
>>
>>
>
>I've no objection; we trim the whitespace from the end on save, so
>there's no worry of infinitely growing series of blank lines.
>
>-- brion vibber (brion @ pobox.com)
>
Dear Brion,

This reminds me: trimming whitespace from the end of _all_ lines on save
would be a good thing.
At the moment, there's a parser/renderer bug which emits empty
paragraphs on seeing a line containing only whitespace. It generates
ugly whitespace on rendered pages, seemingly at random, unless you know
the cause.

A full fix will no doubt be forthcoming in the coming rewrite of
the parser/renderer code, but for now it could be very easily fixed by
stripping trailing whitespace on all lines. I also cannot think of a
situation in which this would be harmful: text-based markup should not
depend on "invisible" features in the source, and this can be viewed as
a kind of normalization.

This could be done either as a pre-pass to the renderer, or simply done
on save, thus fixing all newly edited files.

If you are going to implement the newline append, please consider
implementing trailing whitespace stripping, too.

Regards,

Neil

>
>