Changes

Jump to: navigation, search

Module:Citation/CS1/COinS

221 bytes added, 12:28, 17 December 2015
no edit summary
This function gets the rendered form of an equation according to the editor's preference. It then searches the
rendering for the text equivalent of the rendered equation and replaces the rendering with that.
 
When a replacement is made, this function returns true and the value with replacement
]=]
if not rendering then -- when value doesn't have a math stripmarker, abandon this test
-- return 'not rendering';
return false, value;
end
rendering = rendering:match ('<annotation[^>]+>(.+)</annotation>') -- extract just the math text
else
return false, value; -- had math stripmarker but not one of the three defined forms
end
return true, value:gsub (stripmarker, rendering, 1);
end
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running while replaced do replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation end 
value = value:gsub ('\127UNIQ%-%-math%-[%a%d]+%-QINU\127', "MATH RENDER ERROR"); --
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">&#39;s</span>', "'s"); -- replace {{'s}} template with simple apostrophe-s
Anonymous user

Navigation menu