More actions
Documentation for this module may be created at Module:Deformat/doc
-- Module:Deformat
-- Removes dollar-sign based formatting codes from a string.
local p = {}
function p.run(frame)
local text = frame.args[1] or ''
if not text or text == '' then
return ''
end
local deformattedText = text
deformattedText = mw.ustring.gsub(deformattedText, '%$%$', '$')
deformattedText = mw.ustring.gsub(deformattedText, '%$[lh]%[.-%]', '')
deformattedText = mw.ustring.gsub(deformattedText, '%$%x%x%x?', '')
deformattedText = mw.ustring.gsub(deformattedText, '%$[lh]%[', '')
deformattedText = mw.ustring.gsub(deformattedText, '%$..', '')
return deformattedText
end
return p