Modul:MainArticle
Documentația acestui modul poate fi creată la Modul:MainArticle/doc
local getArgs = require('Modul:Arguments').getArgs
local hatnote = require('Modul:Hatnote')._hatnote
local join = require('Modul:Separated entries')._main
local length = require('Modul:TableTools').size
local p = {}
p._mainArticle = function(args)
local mains = {}
for _idx, element in ipairs(args) do
if mw.text.trim(element) ~= '' then
mains[_idx] = '[[' .. mw.text.trim(element) .. ']]'
end
end
if length(mains) == 0 then return '' end
mains.separator = ', '
mains.conjunction = ' și '
local textToDisplay = (#mains <= 1 and 'Articol principal: ' or 'Articole principale: ') .. join(mains) .. '.'
return hatnote(textToDisplay, { extraclasses = 'rellink boilerplate seealso'}) .. mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Modul:MainArticle/styles.css'} }
end
p.mainArticle = function(frame)
local args = getArgs(frame)
return p._mainArticle(args)
end
return p