630
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
-- This Module implements {{Roman Date}} | -- This Module implements {{Roman Date}} | ||
local numeral = require("Module:Roman Numeral") | |||
local p = {} | local p = {} | ||
Line 84: | Line 86: | ||
local YearMonthDay = {tonumber(args[1][1]), tonumber(args[1][2]), tonumber(args[1][3])} | local YearMonthDay = {tonumber(args[1][1]), tonumber(args[1][2]), tonumber(args[1][3])} | ||
MonthDay = {YearMonthDay[2], YearMonthDay[3]} | MonthDay = {YearMonthDay[2], YearMonthDay[3]} | ||
if YearMonthDay[1] > 0 then | |||
avc = 753 | |||
elseif YearMonthDay[1] < 0 then | |||
avc = 754 | |||
end | |||
if MonthDay[1] > 13 then return end | if MonthDay[1] > 13 then return end | ||
if checkLeapYear(YearMonthDay[1]) then | if checkLeapYear(YearMonthDay[1]) then | ||
Line 95: | Line 102: | ||
local day = dayLookup[MonthDay[2]][MonthDay[1]] | local day = dayLookup[MonthDay[2]][MonthDay[1]] | ||
if day == 'Kal. ' then | if day == 'Kal. ' then | ||
return day .. months.ablative[MonthDay[1]] | return day .. months.ablative[MonthDay[1]] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
elseif day == 'Non. ' then | elseif day == 'Non. ' then | ||
return day .. months.ablative[MonthDay[1]] | return day .. months.ablative[MonthDay[1]] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
elseif day == 'Id. ' then | elseif day == 'Id. ' then | ||
return day .. months.ablative[MonthDay[1]] | return day .. months.ablative[MonthDay[1]] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
else | else | ||
if MonthDay[2] > month_ides_lookup(MonthDay[1]) then | if MonthDay[2] > month_ides_lookup(MonthDay[1]) then | ||
if tonumber(MonthDay[1]) == 12 then | if tonumber(MonthDay[1]) == 12 then | ||
return day .. months.accusative[1] | return day .. months.accusative[1] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
elseif MonthDay[1] == 13 then | elseif MonthDay[1] == 13 then | ||
return day .. months.accusative[3] | return day .. months.accusative[3] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
end | end | ||
return day .. months.accusative[MonthDay[1] + 1] | return day .. months.accusative[MonthDay[1] + 1] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
end | end | ||
return day .. months.accusative[MonthDay[1]] | return day .. months.accusative[MonthDay[1]] .. ' ' .. numeral.main({YearMonthDay[1]+avc}) .. ' AVC' | ||
end | end | ||
else return end | else return end | ||
Line 147: | Line 154: | ||
-- Remove dashes from args to get a table representing {year, month, day} | -- Remove dashes from args to get a table representing {year, month, day} | ||
if type(args[1]) == 'string' then | if type(args[1]) == 'string' then | ||
args[1] = mw.text.split(args[1], '%s | args[1] = mw.text.split(args[1], '(%s+-%s+)|-+') | ||
end | end | ||
return args[1] | |||
return _main(args) | --return _main(args) | ||
end | end | ||
return p | return p |