Module:ExtensionTagRemove

From Derivative
Jump to navigation Jump to search

Documentation for this module may be created at Module:ExtensionTagRemove/doc

local str = {}

local function tableToString(t)
    local key
    local value
    local result

    result = ''

    for key, value in pairs(t) do
        if (tonumber(key) ~= nil) then
            result = result .. string.gsub(value,"<syntaxhighlight lang=python>","<code>")
            result = string.gsub(result,"</syntaxhighlight>","</code>")
        else
            result = result .. '[[Category:' .. value .. ']]\n' 
        end
    end
 
    return result
end

function str.tag(frame)
    return tableToString(frame.args)
end

return str