Module:CareerList: Difference between revisions

no edit summary
No edit summary
No edit summary
local p = {}
 
local function getConfigp.createCareerListTop(siteframe)
local config = mw.loadData("Module:CareerList/config")
return config[site]
end
 
function p.CareerListTop(frame)
local args = frame.args
local list = args.list or ""
local bgcolorbgColor = args.bgcolorbgColor or "#F2F2F2"
local html = mw.html.create()
return string.format([[
 
<table class="wikitable" style="background-color:%s;width:100%%;">
<tr>html:tag("div")
<tr style=:css("background-color:%s;color:%s;">, bgColor)
<th>Site</th>
:wikitext("{| class=\"wikitable career-list\"")
<th>ID</th>
:wikitext("\n|-" .. <th>Alias</th>"\n!")
<th>Notes</th>:wikitext(list)
</tr>:wikitext("\n|}")
 
%s
return tostring(html)
</table>
]], bgcolor, list)
end
 
function p.CareerListcreateCareerList(frame)
local args = frame.args
local site = args.site or ""
local alias = args.alias or mw.title.getCurrentTitle().text
local notes = args.notes or "N/A"
local confightml = getConfigmw.html.create(site)
 
if not config then
local config = mw.loadData("Module:CareerList/configConfig")
return ""
 
returnlocal url = config[site].url or ""
local url = config.url:gsub("%$1", id)
 
local bgColor = "#FFFFFF"
if config[site].type == "Studio" then
bgColor = "#DADADA"
elseif config[site].type == "Website" then
bgColor = "#E7E7E7"
end
 
local url = config.url:gsub("%$1", id)
html:tag("tr")
local bgcolor = config.type == "Studio" and "#DADADA" or "#FFFFFF"
:css("background-color", bgColor)
local color = config.type == "Studio" and "#000000" or "#000000"
</table>:tag("td")
return string.format([[
:wikitext(config[site].name or "")
<tr style="background-color:%s;color:%s;">
<td><a href=:wikitext("%s: ">%s</a></td>)
<td>%s</td>:tag("a")
<td>%s</td> :attr("href", url)
<td>%s</td> :wikitext(alias)
</tr>:done()
return :tag("td")
]], bgcolor, color, url, config.name, id, alias, notes)
<th>Site</th>:wikitext(notes)
%s:done()
 
return tostring(html)
end
 
Anonymous user