Modul:Century
Documentația acestui modul poate fi creată la Modul:Century/doc
local p = {}
local getArgs = require('Modul:Arguments').getArgs
local roman = require('Modul:Roman')._main
p.fromArgs = function(cntr, isFirst, isGenitive, isBC)
local out = 'secolul'
if isGenitive then out = out .. 'ui' end
if isFirst then out = out .. ' I'
else out = out .. ' al ' .. cntr .. '-lea' end
if isBC then out = out .. ' î.e.n.' end
return out
end
p.fromArray = function(args)
local centuryString
local isFirst = false
local isBC = false
if mw.ustring.match(args[1], '^%-?%d+') then
local centuryNumber
centuryNumber = tonumber(args[1])
isFirst = centuryNumber == 1 or centuryNumber == -1
isBC = centuryNumber < 0
centuryNumber = math.abs(centuryNumber)
centuryString = roman({centuryNumber})
else
centuryString = args[1]
if mw.ustring.upper(mw.ustring.sub(centuryString, 1, 2)) == 'I ' then
isFirst = true
end
end
return p.fromArgs(centuryString, isFirst, args.c and mw.ustring.lower(args.c) == 'g', isBC)
end
p.fromFrame = function(frame)
local args = getArgs(frame)
return p.fromArray(args)
end
return p