r104253 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104252‎ | r104253 | r104254 >
Date:21:22, 25 November 2011
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Damn you, Windows
Modified paths:
  • /trunk/extensions/wikihiero/wikihiero.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/wikihiero/wikihiero.body.php
@@ -389,7 +389,7 @@
390390 return;
391391 }
392392
393 - self::$delimiters = array_flip( array( ' ', '-', "\t", "\n" ) );
 393+ self::$delimiters = array_flip( array( ' ', '-', "\t", "\n", "\r" ) );
394394 self::$tokenDelimiters = array_flip( array( '*', ':', '(', ')' ) );
395395 self::$singleChars = array_flip( array( '!' ) );
396396 }

Comments

#Comment by Hashar (talk | contribs)   10:42, 28 November 2011
  • \r (CR, Carriage Return) was only used on pre Mac OS X system.
  • \n (LF) is used by Unix
  • Windows uses both! \r\n (CR then LF).

This probably means that \r\n on windows will trigger two newBlock() in the tokenizer. On occurrence of \n you probably want to skip the block creation if the previous character was \r.

#Comment by MaxSem (talk | contribs)   10:53, 28 November 2011

And newBlock() is designed to handle such calls properly, i.e. by not creating superfuluous blocks ;)

#Comment by MaxSem (talk | contribs)   10:54, 28 November 2011

After all, users easily insert several spaces between hieroglyphs - it doesn't break the parser either.

Status & tagging log