Content deleted Content added
merge month indices |
empty string case and field containing medatata |
||
Line 653:
input = stripFieldExtras(input)
end
-- If there is nothing but whitespace, don't bother
if (mw.ustring.match(input, '^%s*$')) then if (frame.args[2] == 'pretty') then return frame:preprocess('\'\'{{gray|Empty input}}\'\'') else return 'Empty input' end end
local result, startDate, startTime, endDate, endTime = parseDateString(input)
Line 689 ⟶ 692:
return value
end
function hasMetadataTemplates(input)
-- This is a basic list of the template names for metadata emiting tempaltes, there are inr eality more templates and more redirects
if (string.match(input, '%{%{[Ss]tart[ %-]?date')) then return true end
if (string.match(input, '%{%{[Ee]nd[ %-]?date')) then return true end
if (string.match(input, '%{%{[Bb]irth[ %-]?date')) then return true end
if (string.match(input, '%{%{[Dd]eath[ %-]?date')) then return true end
if (string.match(input, '%{%{[Bb]irth[ %-]?year')) then return true end
if (string.match(input, '%{%{[Dd]eath[ %-]?year')) then return true end
if (string.match(input, '%{%{[Ff]ilm ?date')) then return true end
if (string.match(input, '%{%{[ISO[ %-]date')) then return true end
return false
end
Line 699 ⟶ 718:
input = mw.text.decode(mw.text.unstrip(input))
end
input = stripFieldExtras(input)
-- If there is nothing but whitespace, don't bother
if (mw.ustring.match(input, '^%s*$')) then return nil end
-- Then parse the date and see if we get a valid output date
Line 706 ⟶ 728:
if (not frame.args.noErrorCats or frame.args.noErrorCats ~= 'yes') then
--if (result == PARSERESULT_INVALID) then return frame:preprocess('<includeonly>[[Category:]]</includeonly>') end
--if (result == PARSERESULT_INVALIDRANGE) then return frame:preprocess('<includeonly>[[Category:]]</includeonly>') end
if (result == PARSERESULT_INCOMPLETERANGE) then return '<includeonly>[[Category:Articles with incomplete date ranges for automatic metadata]]</includeonly>' end
end
|