Module:Year category type: Difference between revisions
Jump to navigation
Jump to search
(←Created page with 'local p = {} local units = { year = "^%d*$", year_bc = "^%d* BC$", year_ad = "^AD %d*$", decade = "^%d*0s$", decade_bc = "^%d*0s BC$", century = "^%d*[snrt][tdh].century$", century_bc = "^%d*[snrt][tdh].century BC$", millennium = "^%d*[snrt][tdh].millennium$", millennium_bc = "^%d*[snrt][tdh].millennium BC$", } function p.main(frame) local title = mw.title.getCurrentTitle().text for unit, pattern in pairs(units) do if string.match(title, pat...') |
(No difference)
|
Latest revision as of 01:24, 5 February 2022
Documentation for this module may be created at Module:Year category type/doc
local p = {}
local units = {
year = "^%d*$",
year_bc = "^%d* BC$",
year_ad = "^AD %d*$",
decade = "^%d*0s$",
decade_bc = "^%d*0s BC$",
century = "^%d*[snrt][tdh].century$",
century_bc = "^%d*[snrt][tdh].century BC$",
millennium = "^%d*[snrt][tdh].millennium$",
millennium_bc = "^%d*[snrt][tdh].millennium BC$",
}
function p.main(frame)
local title = mw.title.getCurrentTitle().text
for unit, pattern in pairs(units) do
if string.match(title, pattern) then
return unit
end
end
return -1
end
return p