FANDOM


local p = {}
 
function p.hello()
    local data = mw.loadData("Module:JohnnyTOS/2")
 
    local biweekly = {}
    for _, v in pairs(data) do table.insert(biweekly, v) end
    table.sort(biweekly, function(v1,v2) return tonumber(v1.stages[1].icon) < tonumber(v2.stages[1].icon) end)
 
    function dicon_nt(id, name)
        local span = mw.html.create("span")
        span
            :addClass("imtip suppress")
            :attr("data-imtip", name)
            :css("display", "inline")
            :css("text-align", "center")
            :wikitext("[[File:" .. id .. "i.png|link=" .. name .. "|30px]]")
        return tostring(span)
    end
 
    local table_test = mw.html.create("table")
        :addClass("toc")
        :css("text-align", "left")
        :css("margin", "auto")
        :css("line-height", "130%")
        :tag("tr")
            :tag("th")
                :attr("colspan", 2)
                :wikitext("Periodic Stages")
                :css("text-align", "center")
                :done()
            :done()
 
    for _, stage_info in ipairs(biweekly) do
        icon_list = {}
        for _, stage in ipairs(stage_info.stages) do
            table.insert(icon_list, dicon_nt(stage.icon, stage.name))
        end
 
        local row = table_test:tag('tr')
            :tag('td')
                :css("padding-left", ".5em")
                :css("background", "rgba(212,200,139,.5)")
                :wikitext("'''" .. stage_info.series .. "'''")
                :done()
            :tag('td'):wikitext(table.concat(icon_list))
                :done()
            :done()
    end
 
    return tostring(table_test)
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.