Jump to content

Module:Football box collapsible teamname

Frae Wikipedia, the free beuk o knawledge
local i = {};

function i.TeamName(frame)
    local prefix = "";
    local suffix = "";
    local team = frame.args["team"] or "";
    
    if mw.ustring.sub(team,1,3) ~= "'''" and mw.ustring.sub(team,-3) ~= "'''" then
        prefix = "'''" .. '<span class="fn org">';
        suffix = "</span>'''";
    else
        if mw.ustring.sub(team,1,3) == "'''" then
            prefix = '<span class="fn org">';
            team = mw.ustring.sub(team,4);
        else
            prefix = '<span class="fn org">' .. "'''";
        end

        if mw.ustring.sub(team,-3) == "'''" then
            suffix = "</span>";
            team = mw.ustring.sub(team,1,mw.ustring.len(team)-3);
        else
            suffix = "'''</span>";
        end
    end
        
    return prefix .. team .. suffix;
end

return i;