Page MenuHomePhabricator

mw.html doesn't accept tags containing numbers
Closed, ResolvedPublic

Description

In the debug console, the following code:

tostring( mw.html.create( 'h2' ) )

Produces the error "Lua error in mw.html.lua at line 368: Invalid tag name: h2." This is due to the over-zealous Lua pattern at line 78 of mw.html.lua [1]

This should probably be changed from:

return s:match( '^[a-zA-Z]+$' )

To:

return s:match( '^[a-zA-Z]+[0-9]*$' )

Or as it seems that h1 to h6 are the only tags containing numbers, perhaps this could be:

return s:match( '^[a-zA-Z]+$' ) or s:match( '^h[1-6]$' )

[1] https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FScribunto/8e22e0f1f85a296aab805aa2d45e3024acd03f55/engines%2FLuaCommon%2Flualib%2Fmw.html.lua#L78


Version: unspecified
Severity: normal

Details

Reference
bz71594

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:59 AM
bzimport added a project: Scribunto.
bzimport set Reference to bz71594.

gerritadmin wrote:

Change 164535 had a related patch set uploaded by Jackmcbarn:
Allow numbers in tag names

https://gerrit.wikimedia.org/r/164535

gerritadmin wrote:

Change 164535 merged by jenkins-bot:
Allow numbers in tag names

https://gerrit.wikimedia.org/r/164535