Page MenuHomePhabricator

math ml rendering changes and scribunto
Closed, DuplicatePublic

Description

This issue was fully described without resolution at: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)/Archive_147#math_ml_rendering_changes_and_scribunto

the tl;dr version is: scribunto mw.text.unstripNoWiki() no longer unstrips MathML markup as it once did.

Event Timeline

This seems oddly the opposite of what was complained about in T121085: mw.text.unstripNoWiki also unstrips <math> tags.

There's nothing to do for Scribunto here: either the Math extension outputs its markers as "nowiki" markers which can be unstripped, or it outputs them as "general" markers which cannot be.

Perhaps, but I think I realized shortly after that discussion (https://en.wikipedia.org/wiki/Wikipedia_talk:Lua/Archive_4#stripmarkers_and_mw.text.unstripNoWiki.28.29) that it is necessary for Module:Citation/CS1 to have access to the content of <math>...</math> tags in order to correctly render that information in the citation's metadata. Before I came to that realization, the module was percent encoding the strip marker into the metadata which made gibberish of the information (usually article or book titles) and so rendered it mostly useless to metadata consumers.

I think it might be handy for modules to have access to the raw content of any strip marker. MediaWiki identifies the strip markers by type so the module can choose which it wants and then call some function, perhaps mw.mw.text.unstripRaw (strip marker) to get the raw content. Certainly that would make Module:Citation/CS1/COinS simpler because the code wouldn't have to figure out which math rendering preference the current editor has selected and then decode that.

Pkra changed the task status from Open to Stalled.Dec 7 2018, 11:27 AM
Pkra subscribed.

Is this still an issue?

Is this still an issue?

Yes. This is still an issue unless there is now a yet-to-be-documented scributo function that will return the content of a selected stripmarker ... Is there such a function?

Aklapper changed the task status from Stalled to Open.Dec 7 2018, 12:21 PM

Yes. This is still an issue unless there is now a yet-to-be-documented scributo function that will return the content of a selected stripmarker ... Is there such a function?

There's no function to get the contents of "general" markers. And it's not going to happen, as it would reopen T63268 and T73167.

But after re-review of the extension it looks like Math currently isn't even using 'general' markers, instead (when using "mathml" mode) it's reinventing strip markers itself by using the ParserAfterTidy hook. There's no way Scribunto can do anything about that. When using its other modes it looks like it's already using "nowiki" markers that can be unstripped with mw.text.unstripNoWiki().

Thanks for clarifying, @Trappist_the_monk, @Anomie. I'm out of my depth here.