Content deleted Content added
No edit summary |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 80:
end
end
if p.valid(nil,mon3,num8) then month,year,inform=mon3,num8,"month and year" else
if mon3~=nil and num8~=nil then return "Invalid entry" end
--(the unmentioned case: day and month)
local num9,mon4=nil
for i=1,12 do
Line 92:
end
end
if mon4~=nil and p.valid(
if p.valid(nil,mon4,num9) then month,year,inform=mon4,num9,"month and year" else
if mon4~=nil and num9~=nil then return "Invalid entry" end
--fifth try: parse as year
if string.match(indate,"(%d+)%D
local num0=string.match("A"..indate,".*%D(%d+)")
if p.valid(nil,nil,
return "Invalid entry"
end end end end end end end end end end end end end end
--get era
if string.find(indate,"
elseif string.find(indate,"
elseif string.find(indate,"CE") then era=" CE"
elseif string.find(indate,"AD") then era=" AD"
Line 111:
--get uncertainty
if string.match(indate,"around") then circa="circa "
elseif string.match(indate,"uncertain") then circa="circa "
elseif string.match(indate,"about") then circa="circa "
elseif string.match(indate,"approx") then circa="circa "
elseif string.match(indate,"circa") then circa="circa "
elseif string.match(indate,"ca%.") then circa="circa "
else circa="" end
--convert output date to input format -> outdate
local outform=frame.args.format or inform
day,month,year=tonumber(day),tonumber(month),tonumber(year)
outdate = ""
Line 138:
if outform=="month and year" then
outdate = monthnames[month]..year..era
end
if outform=="day and month" then
outdate = day.." "..monthnames[month]
end
if outform=="year" then
|