r109552 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109551‎ | r109552 | r109553 >
Date:17:15, 19 January 2012
Author:mah
Status:ok (Comments)
Tags:miscextensions 
Comment:
fix Bug 33739 - \text{äöü} doesn't add encoding preamble
Modified paths:
  • /trunk/extensions/Math/math/lexer.mll (modified) (history)

Diff [purge]

Index: trunk/extensions/Math/math/lexer.mll
@@ -18,7 +18,7 @@
1919
2020 rule token = parse
2121 space + { token lexbuf }
22 - | "\\text" space * '{' boxchars + '}'
 22+ | "\\text" space * '{' aboxchars + '}'
2323 { Texutil.tex_use_ams (); let str = Lexing.lexeme lexbuf in
2424 let n = String.index str '{' + 1 in
2525 BOX ("\\text", String.sub str n (String.length str - n - 1)) }
@@ -34,6 +34,11 @@
3535 { let str = Lexing.lexeme lexbuf in
3636 let n = String.index str '{' + 1 in
3737 BOX ("\\vbox", String.sub str n (String.length str - n - 1)) }
 38+ | "\\text" space * '{' boxchars + '}'
 39+ { Texutil.tex_use_ams (); let str = Lexing.lexeme lexbuf in
 40+ let n = String.index str '{' + 1 in
 41+ Texutil.tex_use_nonascii();
 42+ BOX ("\\text", String.sub str n (String.length str - n - 1)) }
3843 | "\\mbox" space * '{' boxchars + '}'
3944 { let str = Lexing.lexeme lexbuf in
4045 let n = String.index str '{' + 1 in

Sign-offs

UserFlagDate
Nikerabbitinspected07:05, 20 January 2012

Comments

#Comment by MaxSem (talk | contribs)   09:35, 20 January 2012

Do we have tests for stuff like this?

#Comment by 😂 (talk | contribs)   14:58, 8 February 2012

We should add them if we're going to keep supporting code that none of us can read ;-)

#Comment by Hashar (talk | contribs)   21:45, 13 February 2012

You can try out using OUnit :-)

#Comment by Hashar (talk | contribs)   21:49, 13 February 2012

That pattern match any \\text element with non ascii character. Upon match, it set the encoding to UTF8 (which we should do by default anyway nowadays).


Good for me.

Status & tagging log