Module:Sandbox/Janeccerek/Reign

local p = {}

p.reign = function( frame )
	local start = frame.args.start or "?"
	local ending = frame.args.ending or ""
	local sec_start = frame.args.sec_start
	local sec_ending = frame.args.sec_ending 
	local label = frame.args.label 
	local single = frame.args.single 
	local show = frame.args.show 
	local cap = frame.args.cap 
	local pre_date = frame.args.pre_date
	local post_date = frame.args.post_date
	local mid_date = frame.args.mid_date
	local era = frame.args.era 
	local abbr = "<abbr title='reign'>r.</abbr>"
	local ndash = "&ndash;"
	local nbsp = "&nbsp;"
	if start == "" and not single then start = "?" end
	if show == "none" then 
		abbr = "r."
		end
	if show == "link" then
		abbr = "[[Reign|r.]]"
		end
	if show == "word" then
		abbr = "reigned"
		end
	if show == "colon" then
		abbr = "reign:"
		end
	if show == "lword" then
		abbr = "[[Reign|reigned]]"
		end
	if show == "lcolon" then
		abbr = "[[Reign|reign:]]"
		end
	if show == "blank" then
		abbr = ""
		end
	if cap ~= null then
		if show == "none" then
			abbr = "R."
			end
		if show == "link" then
			abbr = "[[Reign|R.]]"
			end
		if show  == "word" then
			abbr = "Reigned"
			end
		if show == "colon" then
			abbr = "Reign:"
			end
		if show == "lword" then
			abbr = "[[Reign|Reigned]]"
			end
		if show == "lcolon" then
			abbr = "[[Reign|Reign:]]"
			end
		end
	if single then 
		msg = single
		end
	if not single and not pre_date then 
		 msg = start.. ndash ..ending
		end
	if string.match(start, ' ') ~= nil or string.match(ending, ' ') ~= nil then
		msg = start.. nbsp.. ndash.. nbsp.. ending
		end
	if mid_date and sec_start  and sec_ending  and start  and ending  and string.match(sec_start, ' ') ~= nil and string.match(sec_ending, ' ') ~= nil then
		msg = msg.. ", " ..mid_date.. ", " ..sec_start.. ndash ..sec_ending
		end
	if sec_start and sec_ending and not mid_date and string.match(sec_start, ' ') == nil and string.match(sec_ending, ' ') == nil  then
		msg = msg.. " and " ..sec_start.. ndash ..sec_ending
		end
	if sec_start  and sec_ending  and not mid_date and (string.match(sec_start, ' ') ~= nil or string.match(sec_ending, ' ') ~= nil) then
		msg = msg.. " and " ..sec_start.. nbsp.. ndash.. nbsp.. sec_ending
		end
	if sec_start and sec_ending and mid_date and (string.match(sec_start, ' ') ~= nil or string.match(sec_ending, ' ') ~= nil) then
		msg = msg.. ", " ..mid_date.. ", " ..sec_start.. nbsp.. ndash.. nbsp.. sec_ending
		end
	if pre_date and not post_date then
		msg = pre_date.. ", " ..msg
		end
	if post_dat and not pre_date then
		msg = msg.. ", " ..post_date
		end
	if post_date and pre_date and (start == "?" or start == "") and ending == "" then
		msg = pre_date.. ", " ..post_date
		end
	if era then
		msg = msg.. " " ..era
		end
	if not label then
		msg = abbr.. " " ..msg
		else
			msg = label.. ": " ..msg
		end
	return msg
	end	

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.