Module:Data to Table: Difference between revisions

ReisuDesign (talk | contribs)
No edit summary
ReisuDesign (talk | contribs)
No edit summary
Line 16: Line 16:
-- Escape characters
-- Escape characters
local function clean(txt)
local function clean(txt)
txt = txt:gsub('&(%a+;)', '&%1')
return txt
:gsub('\'', '\\'')
:gsub('\\', '\\\\')
:gsub('<', '&lt;')
:gsub('\'', '\\\'')
:gsub('\'', '\\\'')
return txt
end
end


Line 177: Line 175:


-- Wrap output in syntaxhighlight
-- Wrap output in syntaxhighlight
local luaText = tostring(result)
-- Decode HTML entities introduced by mw.html
luaText = mw.text.decode(luaText)
local output = frame:extensionTag(
local output = frame:extensionTag(
'syntaxhighlight',
'syntaxhighlight',
tostring(result),
luaText,
{
{
lang = 'lua',
lang = 'lua',
copy = ''
copy = ''
}
}
)
)