Jump to content

Village Pump:Home/Syntax Highlighting ( archived 2009-06-18 ): Difference between revisions

Another problem with eating whitespace characters: Indentation of first line
(→‎Whitespace: An obscure way to get "uncommented" Whitespace code)
(Another problem with eating whitespace characters: Indentation of first line)
Line 181:
</code>
:: Note that U+FEFF renders as absolutely nothing, and is not whitespace as defined by Whitespace (although it ''is'' whitespace according to Unicode), and therefore should be ignored as "comment" by whitespace interpreters (I didn't test that, though). It apparently also isn't considered whitespace by the start/end line removing code, therefore it's not removed. --[[User:Ce|Ce]] 15:22, 26 January 2009 (UTC)
 
==Another problem with eating whitespace characters==
I just noted another problem with eating whitespace characters, which is related to the Whitespace language problem, but exists for all languages: If the first line is indented, the indentation is eaten. Example:
<code cpp>
int i = 1;
++i;
return i;
</code>
In the source, all lines are indented with two spaces. In the resulting page, the indentation of the first line is gone.
 
IMHO whitespace characters should only be eaten up to and including the first newline. I guess currently there's a regexp like <tt><nowiki>[ \t\n]*</nowiki> for eating the initial whitespace. This should be changed to <tt><nowiki>[ \t]*\n</nowiki></tt>. --[[User:Ce|Ce]] 16:12, 26 January 2009 (UTC)
973

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.