Module:Sandbox/Kid116/Reign Explained

local p=

function p.Reign(frame) local o1 if frame.args[1] then o1 = mw.text.trim(frame.args[1]) if o1

"" then o1 = 0 end else o1 = 0 end local s2 if frame.args[2] then s2 = mw.text.trim(frame.args[2]) if s2

"" then s2 = 0 end else s2 = 0 end local t3 if frame.args[3] then t3 = mw.text.trim(frame.args[3]) if t3

"" then t3 = 0 end else t3 = 0 end local f4 if frame.args[4] then f4 = mw.text.trim(frame.args[4]) if f4

"" then f4 = 0 end else f4 = 0 end local xshow = frame.args.show or 0 local xlabel = frame.args.label or 0 local xcap = frame.args.cap or 0 local xsingle = frame.args.single or 0 local xpredate = frame.args.predate or 0 local xmiddate = frame.args.middate or 0 local xpostdate = frame.args.postdate or 0 local xera = frame.args.era or 0 local x = 0 local y = 0 local z = 0 local v = 0 local u = 0 local t = 0 local w = 0 txt = "" txt1 = "" if o1~=0 then v = 1 if o1:find("%s") then x = 1 end end if s2~=0 then v = 1 if s2:find("%s") then x = 1 end end if t3~=0 then t = 1 if t3:find("%s") then u = 1 end end if f4~=0 then t = 1 if f4:find("%s") then u = 1 end end if xcap

"y" then y = 1 end if xshow

"word" then if y

0 then txt = txt .. "reigned " else txt = txt .. "Reigned " end end if xshow

"colon" then if y

0 then txt = txt .. "reign: " else txt = txt .. "Reign: " end end if xshow

"lword" then if y

0 then txt = txt .. "reigned " else txt = txt .. "Reigned " end end if xshow

"lcolon" then if y

0 then txt = txt .. "reign: " else txt = txt .. "Reign: " end end if xshow

"link" then if y

0 then txt = txt .. "r. " else txt = txt .. "R. " end end if xshow

0 then if y

0 then local abbr = mw.html.create('abbr') abbr :attr('title', 'Reign') :wikitext('r. ') tostring(abbr) txt1 = abbr else local abbr = mw.html.create('abbr') abbr :attr('title', 'Reign') :wikitext('R. ') tostring(abbr) txt1 = abbr end end if xlabel ~= 0 then if y

0 then txt = xlabel .. " " else txt = string.upper(string.sub(xlabel,1,1)) j = string.len(xlabel) for i = 2, tonumber(j) do if string.sub(xlabel,i,i)

" " then z = z+1 else z = 0 end if z<2 then txt = txt .. string.sub(xlabel,i,i) end end txt = txt .. " " end end if xsingle ~= 0 then txt = txt .. xsingle .. " " z = 1 end if z

0 then if xpredate ~= 0 then txt = txt .. xpredate w=1 end if v ~= 0 then if w ~= 0 then txt = txt .. ", " end if o1

0 then if x

0 then txt = txt .. "?-" else txt = txt .. "? - " end else txt = txt .. o1 if s2

0 then txt = txt .. "- " else if x

0 then txt = txt .. "-" else txt = txt .. " - " end end end if s2 ~= 0 then txt = txt .. s2 end end if xmiddate ~= 0 then txt = txt .. ", " .. xmiddate end if v ~= 0 then if t ~= 0 then txt = txt .. ", " if t3

0 then if u

0 then txt = txt .. "?-" else txt = txt .. "? - " end else txt = txt .. t3 if f4

0 then txt = txt .. "- " else if u

0 then txt = txt .. "-" else txt = txt .. " - " end end end if f4 ~= 0 then txt = txt .. f4 end end end if xpostdate ~= 0 then txt = txt .. ", " .. xpostdate end if xera ~= 0 then txt = txt .. " " .. xera end

end return txt1, txt .. " " end

return p