--Google Code in 2017, Update code of the "Reign" template on English Wikipedialocal 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 enddate = "present" end local wrap = frame.args.wrap or "" if secondstart
"" 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
"word" then r = "reigned " if cap
"colon" then r = "reign: " if cap
"lword" then r = "reigned " if cap
"lcolon" then r = "reign: " if cap
"blank" then r = "" end if label ~= "" then r = label.." " end if string.match(startdate, " ") or string.match(enddate, " ") and era
"" then dash2 = " - " else dash2 = "-" end if secondstart
"" 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.."
" if wrap ~= "" then msg = r..predate..startdate..dash..enddate..middate.."
"..secondstart..dash2..secondend..postdate.."
" end return msgend
return p