Modulis:Personas infokaste/Date/Datums

Vikipēdijas lapa
Dokumentācijas ikona Moduļa dokumentācija[izveidot]
local getArgs = require('Module:Arguments').getArgs
local p = {}

function p._dz(args)
	local result
local da = args[1]
local dg = args[2]
local dm = args[3]
local dd = args[4]
local ma = args[5]
local mg = args[6]
local mm = args[7]
local md = args[8]
local note = args[9]

		if da then
			result=da
				elseif ma or mg or mm or md or mv then
					if dg and dm and dd then
						result=mw.getCurrentFrame():expandTemplate{ title = 'dat', args = {dg, dm, dd} }
					elseif dg and (not dm or not dd) then
						result=mw.getCurrentFrame():expandTemplate{ title = 'dat', args = {dg} }
					end--beidzas miršanas datums
			--sākas dzimšanas datums
			elseif dg and dm and dd then
				result=mw.getCurrentFrame():expandTemplate{ title = "dzimšanas datums un vecums", args = {dg, dm, dd} }
			elseif dg and not dm and not dd then
				result=mw.getCurrentFrame():expandTemplate{ title = "dzimšanas gads un vecums", args = {dg} }
			elseif dg and (not dm or not dd) then
				result="<strong class=\"error\">Jānorāda gan mēnesis, gan datums</strong>"
			end

return (result or '') .. (note or '')
end

function p.dz(frame)
	local args = getArgs(frame)
	return p._dz(args)
end

function p._mir(args)
	local result
	local ma = args[1]
	local mg = args[2]
	local mm = args[3]
	local md = args[4]
	local da = args[5]
	local dg = args[6]
	local dm = args[7]
	local dd = args[8]
	local note = args[9]

		if ma then
			result=ma
				elseif da or dg or dm or dd or dv then
					if mg and mm and md and (da or not dg) then
						result=mw.getCurrentFrame():expandTemplate{ title = "dat", args = {mg, mm, md} }
					elseif mg and mm and md and dg and not dm and not dd then
						result=mw.getCurrentFrame():expandTemplate{ title = "Miršanas datums un vecums2", args = {mg, mm, md, dg} }
					elseif mg and mm and md then
						result=mw.getCurrentFrame():expandTemplate{ title = "miršanas datums un vecums", args = {mg, mm, md, dg, dm, dd} }
					elseif mg and (not mm or not md) then
						result=mw.getCurrentFrame():expandTemplate{ title = 'mgv', args = {mg, dg} }
					end

			elseif mg and mm and md then
				result=mw.getCurrentFrame():expandTemplate{ title = 'dat', args = {mg, mm, md} }
			elseif mg and not mm and not md then
				result=mw.getCurrentFrame():expandTemplate{ title = "dat", args = {mg} }
			elseif mg and (not mm or not md) then
				result="<strong class=\"error\">Jānorāda gan mēnesis, gan datums</strong>"
			end

return (result or '') .. (note or '')
end

function p.mir(frame)
	local args = getArgs(frame)
	return p._mir(args)
end

return p