Home
Random
Log in
Settings
About Bronze and Iron: An Andal Invasions AGOT Roleplay Project
Disclaimers
Bronze and Iron: An Andal Invasions AGOT Roleplay Project
Search
Editing
Module:Date
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local lang = mw.getContentLanguage() local p = {} -- Do not replace the following with a variation of #ifexist. This is an expensive parser function that should not be used for this module. local year_articles = { -- When an article is created for a specific year, add it to the list. Don't forget the negative sign for BC! [1] = true, [2] = true, [4] = true, [5] = true, [9] = true, [10] = true, [12] = true, [13] = true, [37] = true, [39] = true, [41] = true, [42] = true, [43] = true, [44] = true, [45] = true, [47] = true, [48] = true, [49] = true, [50] = true, [51] = true, [52] = true, [54] = true, [56] = true, [59] = true, [60] = true, [61] = true, [83] = true, [92] = true, [99] = true, [100] = true, [101] = true, [103] = true, [104] = true, [105] = true, [106] = true, [111] = true, [120] = true, [127] = true, [128] = true, [129] = true, [130] = true, [131] = true, [132] = true, [133] = true, [134] = true, [135] = true, [136] = true, [160] = true, [161] = true, [184] = true, [196] = true, [209] = true, [211] = true, [212] = true, [219] = true, [233] = true, [236] = true, [259] = true, [260] = true, [261] = true, [262] = true, [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [289] = true, [290] = true, [295] = true, [297] = true, [298] = true, [299] = true, [300] = true, } local function is_empty(s) return s == nil or s == '' end function p.link(year, suffix) local s, name, page if year > 0 then s = lang:formatNum(year) name = suffix and (s .. " AC") or s if year_articles[year] then page = mw.title.makeTitle(0, s .. " AC") else page = mw.title.makeTitle( 0, "Years after Aegon's Conquest", "Year " .. s .. " After the Conquest" ) end elseif year < 0 then s = lang:formatNum(math.abs(year)) name = suffix and (s .. " BC") or s if year_articles[year] then page = mw.title.makeTitle(0, s .. " BC") else page = mw.title.makeTitle( 0, "Years before Aegon's Conquest", "Year " .. s .. " Before the Conquest" ) end end return "[[" .. page.fullText .. "|" .. name .. "]]" end function p.nolink(year, suffix) local s = tostring(year) if year > 0 then return suffix and (s .. " AC") or s elseif year < 0 then s = tostring(math.abs(year)) return suffix and (s .. " BC") or s end end function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) local y1 = lang:parseFormattedNumber(args[1]) local y2 = lang:parseFormattedNumber(args[2]) local suffix = yesno(args.suffix) if suffix == nil then suffix = true end if y1 == nil then local text = args[1] return "[[Years after Aegon's Conquest|" .. text .. " AC]]" elseif y2 == nil then if args[2] == '+' then return p.link(y1, true) .. " β Present" else return p.link(y1, suffix) end elseif (y1 > 0) == (y2 > 0) then return p.link(y1, false) .. "β" .. p.link(y2, true) else return p.link(y1, true) .. " β " .. p.link(y2, true) end end function p._format(d) return tonumber(d) and p._main{d} or d end return p
Summary:
Please note that all contributions to Bronze and Iron: An Andal Invasions AGOT Roleplay Project are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (see
Bronze and Iron An Andal Invasions AGOT Roleplay Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Date/doc
(
edit
)