Module:CareerList: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
function p.createCareerListTop(frame) |
|||
| ⚫ | |||
| ⚫ | |||
end |
|||
function p.CareerListTop(frame) |
|||
local args = frame.args |
local args = frame.args |
||
local list = args.list or "" |
local list = args.list or "" |
||
local |
local bgColor = args.bgColor or "#F2F2F2" |
||
local html = mw.html.create() |
|||
return string.format([[ |
|||
<table class="wikitable" style="background-color:%s;width:100%%;"> |
|||
html:tag("div") |
|||
| ⚫ | |||
| ⚫ | |||
:wikitext("{| class=\"wikitable career-list\"") |
|||
<th>ID</th> |
|||
:wikitext("\n|-" .. "\n!") |
|||
:wikitext(list) |
|||
:wikitext("\n|}") |
|||
| ⚫ | |||
return tostring(html) |
|||
| ⚫ | |||
]], bgcolor, list) |
|||
end |
end |
||
function p. |
function p.createCareerList(frame) |
||
local args = frame.args |
local args = frame.args |
||
local site = args.site or "" |
local site = args.site or "" |
||
| Line 29: | Line 23: | ||
local alias = args.alias or mw.title.getCurrentTitle().text |
local alias = args.alias or mw.title.getCurrentTitle().text |
||
local notes = args.notes or "N/A" |
local notes = args.notes or "N/A" |
||
local |
local html = mw.html.create() |
||
if not config then |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
local bgColor = "#FFFFFF" |
|||
if config[site].type == "Studio" then |
|||
bgColor = "#DADADA" |
|||
elseif config[site].type == "Website" then |
|||
bgColor = "#E7E7E7" |
|||
end |
end |
||
| ⚫ | |||
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" |
|||
| ⚫ | |||
return string.format([[ |
|||
:wikitext(config[site].name or "") |
|||
| ⚫ | |||
:wikitext(": ") |
|||
:tag("a") |
|||
:attr("href", url) |
|||
:wikitext(alias) |
|||
:done() |
|||
| ⚫ | |||
]], bgcolor, color, url, config.name, id, alias, notes) |
|||
| ⚫ | |||
| ⚫ | |||
return tostring(html) |
|||
end |
end |
||
Revision as of 22:28, 12 March 2023
Documentation for this module may be created at Module:CareerList/doc
local p = {}
function p.createCareerListTop(frame)
local args = frame.args
local list = args.list or ""
local bgColor = args.bgColor or "#F2F2F2"
local html = mw.html.create()
html:tag("div")
:css("background-color", bgColor)
:wikitext("{| class=\"wikitable career-list\"")
:wikitext("\n|-" .. "\n!")
:wikitext(list)
:wikitext("\n|}")
return tostring(html)
end
function p.createCareerList(frame)
local args = frame.args
local site = args.site or ""
local id = args.id or ""
local alias = args.alias or mw.title.getCurrentTitle().text
local notes = args.notes or "N/A"
local html = mw.html.create()
local config = mw.loadData("Module:CareerList/Config")
local url = config[site].url or ""
url = url:gsub("%$1", id)
local bgColor = "#FFFFFF"
if config[site].type == "Studio" then
bgColor = "#DADADA"
elseif config[site].type == "Website" then
bgColor = "#E7E7E7"
end
html:tag("tr")
:css("background-color", bgColor)
:tag("td")
:wikitext(config[site].name or "")
:wikitext(": ")
:tag("a")
:attr("href", url)
:wikitext(alias)
:done()
:tag("td")
:wikitext(notes)
:done()
return tostring(html)
end
return p