Anonymous user
Module:Citation/CS1/COinS: Difference between revisions
Synch from sandbox;
m (1 revision imported: Math) |
(Synch from sandbox;) |
||
Line 1:
local coins = {};
Line 129 ⟶ 130:
local function coins_replace_math_stripmarker (value)
local stripmarker = cfg.stripmarkers['
local rendering = value:match (stripmarker); -- is there a math stripmarker
Line 156 ⟶ 157:
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain html entities.
2015-12-10: there is a bug in mw.text.unstripNoWiki (). It
when it shouldn't. See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29
Line 166 ⟶ 167:
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running
while replaced do -- loop until all math stripmarkers replaced
replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation
end
value = value:gsub (cfg.stripmarkers['
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">'(s?)</span>', "'
value = value:gsub (' ', ' '); -- replace entity with plain space
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space
value = value:gsub ('‍', ''); -- remove ‍ entities
value = value:gsub ('[\226\128\141\226\128\139\194\173]', '')
value = value:gsub ('[
return value;
end
|