Module:SiteList: Difference between revisions
Jump to navigation
Jump to search
PeaceDeadC (talk | contribs) No edit summary |
PeaceDeadC (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
local function buildRow(siteType, site, |
local function buildRow(siteType, site, id, sceneid, alias, notes) |
||
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' |
local siteLabel = 'N/A' |
||
if siteInfo then |
if siteInfo then |
||
if sceneid and sceneid ~= |
if sceneid and sceneid ~= "" then |
||
link = string.format(siteInfo.sceneFormat, sceneid) |
link = string.format(siteInfo.sceneFormat, sceneid) |
||
elseif id and id ~= |
elseif id and id ~= "" then |
||
link = string.format(siteInfo.idFormat, id) |
link = string.format(siteInfo.idFormat, id) |
||
else |
else |
||
Line 23: | Line 23: | ||
function p.siteList(frame) |
function p.siteList(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local siteType = args[1] |
local siteType = args[1] or 'N/A' |
||
local site = args.site or '' |
local site = args.site or 'N/A' |
||
⚫ | |||
local id = args.id or '' |
local id = args.id or '' |
||
local |
local sceneid = args.sceneid or '' |
||
local |
local alias = args.alias or 'N/A' |
||
⚫ | |||
return buildRow(siteType, site, |
return buildRow(siteType, site, id, sceneid, alias, notes) |
||
end |
end |
||
Revision as of 19:13, 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 and sceneid ~= "" then link = string.format(siteInfo.sceneFormat, sceneid) elseif id and id ~= "" then link = string.format(siteInfo.idFormat, id) else link = siteInfo.defaultLink end siteLabel = string.format("[%s %s]", link, siteInfo.name) else siteLabel = siteType 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] or 'N/A' local site = args.site or 'N/A' local id = args.id or '' local sceneid = args.sceneid or '' local alias = args.alias or 'N/A' local notes = args.notes or 'N/A' return buildRow(siteType, site, id, sceneid, alias, notes) end return p