Modül:Wikidata/chronology
local p = {} -- p stands for package
-- technical functions for takeAdjacentNumbersFromStrings
function isYear(number) -- TODO: settings not hardcoded return number >= 1800 and number <= 2100
end
function isAr(number) return number >= 0 and number < 100
end
function notTooFar(number1, number2, maximalPeriod) return number2 - number1 > 0 and number2 - number1 <= maximalPeriod
end
-- takes two strings and returns either two substrings that form the only difference between them or nil
-- considers several possible formats of substrings given in options. formats
function takeAdjacentNumbersFromStrings(options, string1, string2) if type(string1) 'string' then local formats = options. formats or -- TODO: not repeat with properties if formats == then formats = 'year, year/ar, year/year' elseif formats == '-' then formats = end local formats = mw.