Last modified: 2007-07-13 17:33:48 UTC
In a <math> tag, it should be possible to assign the alt and title attributes of the generated image to something other than the default. If only the alt attribute is specified, then the title attribute should be set to the value of the alt attribute. Example: <math alt="1/2">\frac{1}{2}</math>
Created attachment 704 [details] Patch to add title and alt attributes Added untested patch against HEAD
Created attachment 709 [details] Updated - fix error in prev Fixed the patch
Hmm, I think this won't strip newlines from specified alt or title text. That might be a problem with doBlockLevels unless that's been fixed. (eg if there's a newline followed by a list character)
Created attachment 757 [details] Update - fix typo
(In reply to comment #3) > Hmm, I think this won't strip newlines from specified alt or title text. That might be a problem with > doBlockLevels unless that's been fixed. (eg if there's a newline followed by a list character) Testing with this simple test case shows that it works just fine: <math alt="text" title="some *text #<&> ">y=x+2</math> The text outputed is: <img class='tex' src="/w/images/math/<SOME_HEX_NUMBER>.png" alt="text" title="some *text #<&>" />
Patch as posted (attachment 757 [details]) doesn't appear to work at all, as it references an undefined local variable $params in MathRenderer::_linkToMathImage(). If I change that reference to $this->params and paste in ABCD's sample, I receive this output: <p><img class='tex' src="/head/images/math/daa63ef966cc412541190bc8794731de.png" alt="text" title="some </p> <ul><li>text </li></ul> <ol><li><&> </li></ol> <p>" /> </p>
Created attachment 837 [details] Newest fix Forgot that I fixed the patch again - this one works directly on my private wiki
Created attachment 910 [details] fix it (again!)
Created attachment 911 [details] fix it (again!!) - wrong type patch
Created attachment 912 [details] fix it (again!!!) - forgot a file I really need to proofread first
So, it's been a few months already, was the patch added or recorrected ?
Why not other HTML attributes? class, style, id, and longdesc would all be potentially handy. (IMO, *all* HTML-style tags should have these, where appropriate: why not?) Naturally, class/style would be applied to the enclosing <span>, not to the <img>. (In reply to comment #11) > So, it's been a few months already, was the patch added or recorrected ? Evidently not.
Besides images, tables generated from tex input would benefit from classes. Perhaps all <code>img</code> and <code>table</code> elements should have a class of „math“ anyway.
Done in r24065. Note that 'title' may or may not be technically valid on <math> embedded in HTML, it's kind of unclear, but Mozilla likes it.