r87941 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87940‎ | r87941 | r87942 >
Date:00:01, 13 May 2011
Author:thenub314
Status:resolved (Comments)
Tags:brion, math, needs-parsertests 
Comment:
A change to fix a bug in LaTeX rendering of function names. An
additional space was necessary in the LaTeX code when rendering
functions such as \sin foo32. Also a few lines of code were removed
from texutil.ml that are now handled by lexer.mll.
Modified paths:
  • /trunk/extensions/Math/math/lexer.mll (modified) (history)
  • /trunk/extensions/Math/math/texutil.ml (modified) (history)

Diff [purge]

Index: trunk/extensions/Math/math/lexer.mll
@@ -66,7 +66,7 @@
6767 | "\\" (latex_function_names as name) space * "\\{"
6868 { LITERAL (MHTMLABLEFC(FONT_UFH, "\\" ^ name ^ "\\{", name ^ "{", MF, name, "{")) }
6969 | "\\" (latex_function_names as name) space *
70 - { LITERAL (MHTMLABLEC(FONT_UFH,"\\" ^ name, name ^ " ", MF, name)) }
 70+ { LITERAL (MHTMLABLEC(FONT_UFH,"\\" ^ name ^ " ", name ^ " ", MF, name)) }
7171 | "\\" (mediawiki_function_names as name) space * "("
7272 { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEFC(FONT_UFH,
7373 "\\operatorname{" ^ name ^ "}(", name ^ "(", MF, name, "("))) }
@@ -77,7 +77,7 @@
7878 { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEFC(FONT_UFH,
7979 "\\operatorname{" ^ name ^ "}\\{", name ^ "{", MF, name, "{"))) }
8080 | "\\" (mediawiki_function_names as name) space *
81 - { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}", name ^ " ", MF, name))) }
 81+ { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "} ", name ^ " ", MF, name))) }
8282 | "\\" alpha + { Texutil.find (Lexing.lexeme lexbuf) }
8383 | "\\," { LITERAL (HTMLABLE (FONT_UF, "\\,"," ")) }
8484 | "\\ " { LITERAL (HTMLABLE (FONT_UF, "\\ "," ")) }
Index: trunk/extensions/Math/math/texutil.ml
@@ -269,10 +269,6 @@
270270 | "\\limits" -> LITERAL (TEX_ONLY "\\limits ")
271271 | "\\nolimits" -> LITERAL (TEX_ONLY "\\nolimits ")
272272 | "\\top" -> LITERAL (TEX_ONLY "\\top ")
273 - | "\\arccot" -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arccot}}","arccot")))
274 - | "\\arcsec" -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arcsec}}","arcsec")))
275 - | "\\arccsc" -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arccsc}}","arccsc")))
276 - | "\\sgn" -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{sgn}}","sgn")))
277273 | "\\bullet" -> LITERAL (HTMLABLE (FONT_UFH, "\\bullet ", "•"))
278274 | "\\bull" -> LITERAL (HTMLABLE (FONT_UFH, "\\bullet ", "•"))
279275 | "\\angle" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\angle ", "∠")))

Follow-up revisions

RevisionCommit summaryAuthorDate
r96990Revert changes to texvc that provide no test cases or examples of what they'r...brion19:00, 13 September 2011
r96993MFT r96990: provisional revert of texvc changes that don't come with any test...brion19:07, 13 September 2011
r97034* (bug 6722) Spacing fixes for math functions with/without parens...brion00:49, 14 September 2011

Comments

#Comment by Thelema314 (talk | contribs)   13:11, 29 August 2011

Changes in lexer do just add spaces after escaped operators. I haven't checked that the \arc* functions and \sgn are already handled by the lexer, but if they're added as latex_function_names or mediawiki_function_names, then they look like they are.

#Comment by Brion VIBBER (talk | contribs)   18:49, 13 September 2011

Sounds like this needs a parser test case to confirm the fix and prevent regressions.

#Comment by Brion VIBBER (talk | contribs)   19:04, 13 September 2011

Provisionally reverted in r96990 pending test cases.

#Comment by Brion VIBBER (talk | contribs)   00:51, 14 September 2011

Reapplied in r97034 along with test cases & some friends.

Status & tagging log