Page MenuHomePhabricator

mw.text.unstripNoWiki also unstrips <math> tags
Closed, InvalidPublic


On enwiki, using mw.text.unstripNoWiki on <math> tags will give you the raw HTML output. Sample code:

local p = {}

function p.main()
	local frame = mw.getCurrentFrame()
	return mw.text.unstripNoWiki(frame:preprocess('<math>foo</math>'))

return p

When calling that from the debug console with =p.main(), I get <img class="mwe-math-fallback-image-inline tex" alt="foo" src="//" />. Instead, it should be showing the strip marker.

Event Timeline

MrStradivarius raised the priority of this task from to Needs Triage.
MrStradivarius updated the task description. (Show Details)
MrStradivarius added a subscriber: MrStradivarius.
Anomie claimed this task.
Anomie added a subscriber: Anomie.

The Math extension is registering its strip markers as 'nowiki' markers, so when Scribunto calls StripState::unstripNoWiki() the math markers are included in the unstripping. I don't know if there's any particular reason that T62799 wanted to use nowiki markers rather than general markers, possibly so it would be passed through Tidy.

I note that the core "<html>" tag (see $wgRawHtml) is also registered as a 'nowiki' marker, as are tags from the NamespaceHTML, SecureHTML, and MathSearch extensions.

I remember something about mathml output using nowiki markers, because the validators don't know about mathml.. How this works with other modes etc, etc and if that was carelessly or correctly applied is difficult to say without further investigation.

Restricted Application added a subscriber: jeblad. · View Herald TranscriptOct 16 2020, 5:28 PM