Module:Sandbox/Mrkermit

local A = { } local HF = require("Module:HF") local parent = nil local build = function(arg, arg2, category) local built = "" local link = "" local text = "" if not HF.isempty(arg) then link = arg if not HF.isempty(arg2) then text = arg2 else link = string.match(arg, "([^%[%|%]]+)") text = string.match(arg, "%|([^%]%|]+)") end if string.find(link, "w:c:") == nil and string.find(link, "Glossary:") == nil and string.find(link, "#") == nil then if not HF.isempty(link) and not HF.isempty(text) then built = "" .. text .. "" elseif not HF.isempty(link) and HF.isempty(text) then built = "" .. link .. "" else built = arg end else built = arg end end return built end local suffixTag = function(text) local tag = mw.html.create( 'span' ) :css( 'color', 'darkgreen' ) :css( 'font-weight', 'bold' ) :css( 'font-style', 'italic' ) :css( 'font-size', 'smaller' ) :wikitext('('..text..')') :done return tostring(tag) end function A.appearances(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = parent.args[2] local arg3 = parent.args[3] local category = '/Appearances' local output = '' if HF.isempty(arg3) then output = build(arg, arg2, category) else output = build(arg, arg2, category) .. ' ' .. suffixTag(arg3) end return output end

function A.appold(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = parent.args[2] local arg3 = parent.args[3] local category = "/Appearances" local output = "" if HF.isempty(arg3) then output = build(arg, arg2, category) else output = build(arg, arg2, category) .. "  \'\'\'\'\'(" .. arg3 .. ")\'\'\'\'\' " end

return output end function A.apn(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = nil local category = '/Appearances' local output = '' output = build(arg, arg2, category) return output end function A.mentions(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = parent.args[2] local arg3 = parent.args[3] local category = '/Mentions' local output = '' if HF.isempty(arg3) then output = build(arg, arg2, category) .. ' ' .. suffixTag('Mentioned') else output = build(arg, arg2, category) .. ' ' .. suffixTag(arg3) end return output end

function A.menold(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = parent.args[2] local arg3 = parent.args[3] local category = "/Mentions" local output = "" if HF.isempty(arg3) then output = build(arg, arg2, category) .. "  \'\'\'\'\'(Mentioned)\'\'\'\'\' " else output = build(arg, arg2, category) .. "  \'\'\'\'\'(" .. arg3 .. ")\'\'\'\'\' " end return output end function A.minor(frame) parent = frame:getParent local arg = parent.args[1] local arg2 = parent.args[2] local arg3 = parent.args[3] local category = '/Minor_Appearances' local output = '' if HF.isempty(arg3) then output = build(arg, arg2, category) else output = build(arg, arg2, category) .. ' ' .. suffixTag(arg3) end return output end return A