Module:Infobox ngation: Difference between revisions
Jump to navigation
Jump to search
mh>Viklo No edit summary |
m (5 revisions imported) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
local rulerTitlesRaw = frame.args["ruler-title"] or "" | local rulerTitlesRaw = frame.args["ruler-title"] or "" | ||
local rulerTitles = {} | local rulerTitles = {} | ||
for i in string.gmatch(frame.args["ruler-title"], " | for i in string.gmatch(frame.args["ruler-title"], "[^;]+") do | ||
table.insert(rulerTitles, i) | table.insert(rulerTitles, i) | ||
end | end | ||
local ret = "" | local ret = "" | ||
local n = 0 | local n = 0 | ||
for i in string.gmatch(frame.args["ruler"], " | for i in string.gmatch(frame.args["ruler"], "[^;]+") do | ||
n = n + 1 | n = n + 1 | ||
local rulerTitle = rulerTitles[n] or "Ruler" | local rulerTitle = rulerTitles[n] or "Ruler" | ||
ret = ret .. "<br>'''" .. rulerTitles[n] .. ":''' " .. i | ret = ret .. "<br>'''" .. rulerTitles[n] .. ":''' " .. i | ||
end | |||
return ret | |||
end | |||
p.generateRulerList = function(frame) | |||
local rulerTitlesRaw = frame.args["ruler-title"] or "" | |||
local rulerTitles = {} | |||
for i in string.gmatch(frame.args["ruler-title"], "[^;]+") do | |||
table.insert(rulerTitles, i) | |||
end | |||
local ret = "" | |||
local n = 0 | |||
for i in string.gmatch(frame.args["ruler"], "[^;]+") do | |||
n = n + 1 | |||
local rulerTitle = rulerTitles[n] or "Ruler" | |||
ret = ret .. frame:expandTemplate{ title = "Infobox/row", args = { rulerTitles[n], i } } | |||
end | end | ||
return ret | return ret | ||
end | end | ||
return p | return p |
Latest revision as of 06:02, 12 June 2024
Documentation for this module may be created at Module:Infobox ngation/doc
local p = {} p.generateGovernmentRulerList = function(frame) local rulerTitlesRaw = frame.args["ruler-title"] or "" local rulerTitles = {} for i in string.gmatch(frame.args["ruler-title"], "[^;]+") do table.insert(rulerTitles, i) end local ret = "" local n = 0 for i in string.gmatch(frame.args["ruler"], "[^;]+") do n = n + 1 local rulerTitle = rulerTitles[n] or "Ruler" ret = ret .. "<br>'''" .. rulerTitles[n] .. ":''' " .. i end return ret end p.generateRulerList = function(frame) local rulerTitlesRaw = frame.args["ruler-title"] or "" local rulerTitles = {} for i in string.gmatch(frame.args["ruler-title"], "[^;]+") do table.insert(rulerTitles, i) end local ret = "" local n = 0 for i in string.gmatch(frame.args["ruler"], "[^;]+") do n = n + 1 local rulerTitle = rulerTitles[n] or "Ruler" ret = ret .. frame:expandTemplate{ title = "Infobox/row", args = { rulerTitles[n], i } } end return ret end return p