Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Jikat2/reigntemplate
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!
--Google Code in 2017, Update code of the "Reign" template on English Wikipedia local p = {} p.reign = function(frame) local startdate = frame.args.startdate or "?" local enddate = frame.args.enddate or "present" local secondstart = frame.args.secondstart or "" local secondend = frame.args.secondend or "" if #startdate == 0 then startdate = "?" end if #enddate == 0 then enddate = "present" end local wrap = frame.args.wrap or "" if secondstart == "" and secondend ~= "" then secondstart = "?" end if secondend == "" and secondstart ~= "" then secondend = "present" end local era = frame.args.era or "" if era ~= "" then era = " "..era end local single = frame.args.single or "" local postdate = frame.args.postdate or "" if postdate ~= "" then postdate = ","..postdate end local predate = frame.args.predate or "" if predate ~= "" then predate = predate..", " end local middate = frame.args.middate or "" if middate ~= "" then middate = middate..", " end local label = frame.args.label or "" if single ~= "" then startdate = single enddate = "" end if postdate ~= "" then postdate = postdate..era elseif secondend ~= "" then secondend = secondend..era else enddate = enddate..era end local dash ="" local dash2 ="" local r = "" local cap = frame.args.cap or "n" local show = frame.args.show or "normal" if show == "normal" then r = "<abbr title='reign'>".."r.".."</abbr>" elseif show == "word" then r = "reigned " if cap == "y" then r = "Reigned " end elseif show == "colon" then r = "reign: " if cap == "y" then r = "Reign: " end elseif show == "lword" then r = "[[Reign|reigned]] " if cap == "y" then r = "[[Reign|Reigned]] " end elseif show == "lcolon" then r = "[[Reign|reign:]] " if cap == "y" then r = "[[Reign|Reign:]] " end elseif show == "blank" then r = "" end if label ~= "" then r = label.." " end if string.match(startdate, " ") or string.match(enddate, " ") and era == "" then dash = " - " else dash = "-" end if string.match(secondstart, " ") or string.match(secondend, " ") and era == "" then dash2 = " - " else dash2 = "-" end if secondstart == "" and secondend == "" then dash2 ="" end if secondstart ~= "" then enddate = enddate..", " end if single ~= "" then dash="" end local msg =r.." "..predate..startdate..dash..enddate..middate..secondstart..dash2..secondend..postdate.."<br>" if wrap ~= "" then msg = r..predate..startdate..dash..enddate..middate.."<br>"..secondstart..dash2..secondend..postdate.."<br>" end return msg end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Jikat2/reigntemplate/doc
(
edit
)