Module: Season: Difference between revisions
From A Wiki of Ice and Fire
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
local article = "Game of Thrones - Season " | local article = "Game of Thrones - Season " | ||
local seasons = iterate(arg) | local seasons = iterate(arg) | ||
local root = mw.html.create('div') | if seasons[2] == nil then | ||
return "Season [[" .. article .. tostring(seasons[1]) .. "|" .. tostring(seasons[1]) .. "]]" | |||
else | |||
local root = mw.html.create('div') | |||
:wikitext(" | root:addClass("hlist") | ||
for k,season in pairs(seasons) do | |||
root:newline() | |||
if k == 1 then | |||
root:wikitext("* Seasons ") | |||
else | |||
root:wikitext("* ") | |||
end | |||
root:wikitext("[[" .. article .. tostring(season) .. "|" .. tostring(season) .. "]]") | |||
end | |||
return tostring(root) | |||
end | end | ||
end | end | ||
Latest revision as of 18:44, 8 July 2018
Documentation for this module may be created at Module:Season/doc
local iterate = require('Module:Iterate').iterate
local p = {}
function p._seasons(arg)
local article = "Game of Thrones - Season "
local seasons = iterate(arg)
if seasons[2] == nil then
return "Season [[" .. article .. tostring(seasons[1]) .. "|" .. tostring(seasons[1]) .. "]]"
else
local root = mw.html.create('div')
root:addClass("hlist")
for k,season in pairs(seasons) do
root:newline()
if k == 1 then
root:wikitext("* Seasons ")
else
root:wikitext("* ")
end
root:wikitext("[[" .. article .. tostring(season) .. "|" .. tostring(season) .. "]]")
end
return tostring(root)
end
end
function p.main(frame)
local args = frame.args
if args[1] == nil then
args = frame:getParent().args
end
if args[1] == nil then
return ""
end
return p._seasons(args[1])
end
return p