Page MenuHomePhabricator

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

Description

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>'))
end

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="//upload.wikimedia.org/math/a/c/b/acbd18db4cc2f85cedef654fccc4a4d8.png" />. 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 project: Scribunto.
MrStradivarius subscribed.
Anomie claimed this task.
Anomie subscribed.

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