Jump to content

Module:FindYDCportal

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrownHairedGirl (talk | contribs) at 20:14, 22 November 2018 (Created page with 'local p = {} function p.navyear(frame) --Expects one paramter -- {{{1}}}= a 3- or 4-digit year or deacde -- e.g. 1916 -- 1504 -- 1630s...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.navyear(frame)
	--Expects one paramter
	-- {{{1}}}= a 3- or 4-digit year or deacde
	--    e.g. 1916
	--         1504
	--         1630s
	--         920s
	local arg1 = frame.args[1]
	if arg1 == nil
	then
		return ""
	end
	if (mw.ustring.match(arg1, "^%d%d%d%d?$")) then
		return checkYear(tonumber(arg1))
	elseif (mw.ustring.match(arg1, "^%d%d%d?0s$")) then
		return checkDecade(mw.ustring.gsub(arg1, "^(%d%d%d?0)s$"), "%1")
	end
	return ""
end

return p