Module:SiteList: Difference between revisions

From Porn Base Central
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
local siteInfo = mw.loadData('Module:SiteDictionary')[site:lower()]
local siteInfo = mw.loadData('Module:SiteDictionary')[site:lower()]
local link = 'N/A'
local link = 'N/A'
local siteLabel = 'N/A'
if siteInfo then
if siteInfo then
if sceneid then
if sceneid then
Line 12: Line 13:
link = siteInfo.defaultLink
link = siteInfo.defaultLink
end
end
siteLabel = string.format("[%s %s]", link, siteInfo.name)
end
end
return string.format('|\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n|-', siteType, siteLabel, alias or 'N/A', notes or 'N/A')

local siteLabel = siteType == 'Website' and 'Website' or 'Studio'
return string.format('|\n| style="text-align:center;vertical-align:middle; background-color:#E7E7E7;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n|-', siteLabel, link, alias or 'N/A', notes or 'N/A')
end
end



Revision as of 17:51, 21 July 2023

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

local p = {}

local function buildRow(siteType, site, id, sceneid, alias, notes)
    local siteInfo = mw.loadData('Module:SiteDictionary')[site:lower()]
    local link = 'N/A'
    local siteLabel = 'N/A'
    if siteInfo then
        if sceneid then
            link = string.format(siteInfo.sceneFormat, sceneid)
        elseif id then
            link = string.format(siteInfo.idFormat, id)
        else
            link = siteInfo.defaultLink
        end
        siteLabel = string.format("[%s %s]", link, siteInfo.name)
    end
    return string.format('|\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n|-', siteType, siteLabel, alias or 'N/A', notes or 'N/A')
end

function p.siteList(frame)
    local args = frame:getParent().args
    local siteType = args[1]
    local site = args.site
    local id = args.id
    local sceneid = args.sceneid
    local alias = args.alias
    local notes = args.notes
    return buildRow(siteType, site, id, sceneid, alias, notes)
end

return p