Documentation for this module may be created at Module:Sandbox/Subi/doc
local p = {} -- p stands for package
p.reign0 = function( frame )
local one = frame.args.start or "?"
local two = frame.args.ending or ""
local three = frame.args.sec_start
local four = frame.args.sec_ending
local pred = frame.args.pre_date
local postd = frame.args.post_date
local midd = frame.args.mid_date
local era = frame.args.era
local single = frame.args.single
local label = frame.args.label
local show = frame.args.show
local cap = frame.args.cap
local re = "<abbr title='reign'>r.</abbr>"
if one == "" and not single then one = "?" end
if show == "none" then
re = "r."
end
if show == "link" then
re = "[[Reign|r.]]"
end
if show == "word" then
re = "reigned"
end
if show == "colon" then
re = "reign:"
end
if show == "lword" then
re = "[[Reign|reigned]]"
end
if show == "lcolon" then
re = "[[Reign|reign:]]"
end
if show == "blank" then
re = ""
end
if cap == "y" then
if show == "none" then
re = "R."
end
if show == "link" then
re = "[[Reign|R.]]"
end
if show == "word" then
re = "Reigned"
end
if show == "colon" then
re = "Reign:"
end
if show == "lword" then
re = "[[Reign|Reigned]]"
end
if show == "lcolon" then
re = "[[Reign|Reign:]]"
end
end
if single then
msg = single
end
if not single then
msg = one .. "-" .. two
end
if string.match(one, ' ') ~= nil or string.match(two, ' ') ~= nil then
msg = one.. " - " .. two
end
if three and four and midd and string.match(three, ' ') == nil and string.match(four, ' ') == nil then
msg = msg.. ", " ..midd.. ", " ..three.. "-" ..four
end
if three and four and midd and (string.match(three, ' ') ~= nil or string.match(four, ' ') ~= nil) then
msg = msg.. ", " ..midd.. ", " ..three.. " - " .. four
end
if three and four and not midd and string.match(three, ' ') == nil and string.match(four, ' ') == nil then
msg = msg.. " and " ..three.. "-" ..four
end
if three and four and not midd and (string.match(three, ' ') ~= nil or string.match(four, ' ') ~= nil) then
msg = msg.. " and " ..three.. " - ".. four
end
if pred then
msg = pred.. ", " ..msg
end
if postd then
msg = msg.. ", " ..postd
end
if postd and pred and (one == "?" or one == "") and two == "" then
msg = pred.. ", " ..postd
end
if era then
msg = msg.. " " ..era
end
if not label then
msg = re.. " " ..msg
else
msg = label .. ": " .. msg
end
return msg
end
return p