Module:Plain text: Difference between revisions

Content deleted Content added
better stripping, strip out more stuff
m 1 revision imported from templatewiki:Module:Plain_text
Line 11:
if not text then return end
text = mw.text.killMarkers(text)
:gsub('&nbsp;<span class="nowrap">(.+)</span>', ' %1') --replaceremove nbspnowrap spaceswhile withkeeping regulartext spacesinside
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<span.->(.-)</span.->', '%1') --remove spans while keepingstrip textout insidetags
:gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside
:gsub('<.->.-<.->', '') --strip out remaining tags and the text inside
:gsub('<.->', '') --remove any other tag markup
:gsub('%[%[%s*[Ff]ile%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii]mage%s*:.-%]%]', '') --strip out use of image:
Line 24 ⟶ 21:
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
:gsub('----', '') --remove ---- lines
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
:gsub("%s+", " ") --strip redundant spaces
return text
end