Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
MathModePlugin can produce img tags that span lines, and these are not always rendered as images. Instead, the < and > are converted to < and > and so the browser shows the img tag code.
For example, this example taken from
MathModePlugin:
<latex title="Calligraphics" color="orange">
\cal
A, B, C, D, E, F, G, H, I, J, K, L, M, \\
\cal
N, O, P, Q, R, S, T, U, V, W, X, Y, Z
</latex>
... produces this HTML:
<img alt="\cal
A, B, C, D, E, F, G, H, I, J, K, L, M, \ \cal
N, O, P, Q, R, S, T, U, V, W, X, Y, Z" class="mmpImage" src="/fw/pub/System/MathModePlugin/_MathModePlugin_2a610dcb31a93be293067cf1a48e8c4e.png" title="Calligraphics" color="orange" size="Large" />
Foswiki does not, in general, handle img tags that span multiple lines.
MathModePlugin strips leading whitespace and trailing whitespace, and it appears that foswiki removes backslash-newline sequences from the alt attribute, and I think that is why this example (also from
MathModePlugin) works:
<latex>
{\cal P} & = & \{f_1, f_2, \ldots, f_m\} \\
{\cal C} & = & \{c_1, c_2, \ldots, c_m\} \\
{\cal N} & = & \{n_1, n_2, \ldots, n_m\}
</latex>
... producing this HTML:
<img alt="{\cal P} & = & \{f_1, f_2, \ldots, f_m\} \ {\cal C} & = & \{c_1, c_2, \ldots, c_m\} \ {\cal N} & = & \{n_1, n_2, \ldots, n_m\}" class="mmpImage" src="/fw/pub/System/MathModePlugin/_MathModePlugin_350ce2adb8eb45bb05ff77b5f45cf15d.png" />
I can fix the problem by changing this in entityEncode() in lib/Foswiki/Plugins/MathModePlugin/Core.pm
s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|$extra])/'&#'.ord($1).';'/ge;
to
s/([[\x01-\x1f"%&'*<=>@[_\|$extra])/'&#'.ord($1).';'/ge;
(see
http://trac.foswiki.org/browser/trunk/MathModePlugin/lib/Foswiki/Plugins/MathModePlugin/Core.pm?rev=3649#L226 for context).
--
MichaelTempest - 20 Jun 2009
Michael, tested your fix. Works perfectly. Would you like to check it in?
--
MichaelDaum - 24 Jun 2009
Will do.
--
MichaelTempest - 24 Jun 2009
Done. Task closed.
--
MichaelTempest - 24 Jun 2009