Module:Sandbox/Clockery/reign explained

p =

local nowrap = function(wtext) local span2 = mw.html.create('span') span2 :attr('id', 'nowrap-span') :css('white-space', 'nowrap') :wikitext(wtext) return span2end

local sortable = function(var) local span1 = mw.html.create('span') local text = frame.args.text span1 :attr('id', 'sortable-span') :css('display', 'none') :css('speak', 'none') :wikitext(var) return span1end

p.reign = function(frame) returntext = "" sort = frame.args.sortable era = frame.args.era wp = frame.args.wrap nolabel = frame.args.label lk = frame.args.show cap = frame.args.cap pred = frame.args.predate date1 = frame.args[1] date2 = frame.args[2] date3 = frame.args[3] date4 = frame.args[4] mid = frame.args.middate postd = frame.args.postdate temp = mw.text.trim(frame.args[1] or "") .. mw.text.trim(frame.args[2] or "") temp2 = mw.text.trim(frame.args[3] or "") .. mw.text.trim(frame.args[4] or "") if nolabel ~= nil then returntext = returntext .. nolabel if wp ~= nil then returntext = returntext ..frame:expandTemplate end else if lk

'no' or lk

'off' or lk

'n' or lk

'false' or lk

'0' or lk

'none' then if cap ~= nil then returntext = returntext .. 'R.' else returntext = returntext .. 'r.' end elseif lk

'link' or lk

'yes' or lk

'on' or lk

'y' or lk

'true' or lk

'1' then if cap ~= nil then returntext = returntext .. 'R' else returntext = returntext .. 'r' end elseif lk

'word' then if cap ~= nil then returntext = returntext .. 'Reigned' else returntext = returntext .. 'reigned' end elseif lk

'colon' then if cap ~= nil then returntext = returntext .. 'Reign:' else returntext = returntext .. 'reign:' end elseif lk

'lword' then if cap ~= nil then returntext = returntext .. 'Reigned' else returntext = returntext .. 'reigned' end elseif lk

'lcolon' then if cap ~= nil then returntext = returntext .. 'Reign:' else returntext = returntext .. 'reign:' end elseif lk

'blank' then returntext = returntext .. "" elseif lk

'abbr' or lk

nil then if cap ~= nil then returntext = returntext .. frame:expandTemplate .. '.' else returntext = returntext .. frame:expandTemplate .. '.' end end end if pred ~= nil or date1 ~= nil or date2 ~= nil then returntext = returntext .. ' ' end if pred ~= nil then returntext = returntext .. pred .. ', ' if wp ~= nil then returntext = returntext .. frame:expandTemplate end end if date1 ~= nil then returntext = returntext .. mw.text.trim(frame.args[1] or "") end if date2 ~= nil then if date1

"" then returntext = returntext .. '?' end if mw.ustring.find(temp, '%s', 1, false)

nil then returntext = returntext .. '–' .. mw.text.trim(frame.args[2] or "") else returntext = returntext .. ' – ' .. mw.text.trim(frame.args[2] or "") end if mid ~= nil then returntext = returntext .. ', ' if wp ~= nil then returntext = returntext .. frame:expandTemplate end returntext = returntext .. mid end if date3 ~= nil or date4 ~= nil then returntext = returntext .. ', ' if wp ~= nil then returntext = returntext .. frame:expandTemplate end if date3 ~= nil then returntext = returntext .. mw.text.trim(frame.args[3] or "") end if date4 ~= nil then if date3

"" then returntext = returntext .. '?' end end if mw.ustring.find(temp2, '%s', 1, false)

nil then returntext = returntext .. '–' .. mw.text.trim(frame.args[4] or "") else returntext = returntext .. ' – ' .. mw.text.trim(frame.args[4] or "") end end else if date1 ~= nil then returntext = returntext .. '– ' end end if postd ~= nil then if date1 ~= nil or date2 ~= nil then returntext = returntext .. ', ' end if wp ~= nil then returntext = returntext .. frame:expandTemplate end returntext = returntext .. postd end if era ~= nil then returntext = returntext .. ' ' .. era end if sort ~= nil then returntext = sortable(returntext) end if wp

nil then returntext = nowrap(returntext) end return returntextend

return p