▶️
Planeshift.
Документацию для этого шаблона или модуля можно найти в Template:Hatnote.
Вы можете быть перенаправлены на другой язык вики, если перевод недоступен.
Зависимости
local p = {}
local getArgs = require('Модуль:Arguments').getArgs
local i18n = {
-- Prefixes
see_also_prefix = 'Смотрите также',
main_article_prefix_singular = 'Основная статья',
main_article_prefix_plural = 'Основные статьи',
-- Separators
prefix_separator = ': ',
-- Errors
error_no_text = 'Нет текста',
}
function p.hatnote(frame)
-- Implements Template:Hatnote.
local args = getArgs(frame, {
wrappers = {
'Шаблон:О числе'
}
})
assert(args[1], i18n.error_no_text)
return p._main(args[1], args['style'])
end
function p.main_article(frame)
-- Implements Template:Main.
local args = getArgs(frame, {
wrappers = {
'Шаблон:Подробно'
}
})
assert(args[1], i18n.error_no_text)
local text = i18n.main_article_prefix_singular
if args[2] then text = i18n.main_article_prefix_plural end
text = text .. i18n.prefix_separator
local articles, n = {}, 1
while args[n] do
table.insert(articles, '[[' .. args[n] .. '|' .. (args['l' .. n] or args[n]) .. ']]')
n = n + 1
end
local text = text .. mw.text.listToText(articles)
return p._main(text)
end
function p.see_also(frame)
-- Implements Template:See also.
local args = getArgs(frame, {
wrappers = {
'Шаблон:See also'
}
})
assert(args[1], i18n.error_no_text)
local articles, n = {}, 1
while args[n] do
local title = args['l' .. n] or args[n]
table.insert( articles, '[[' .. args[n] .. '|' .. title .. ']]' )
n = n + 1
end
local text = i18n.see_also_prefix .. i18n.prefix_separator .. mw.text.listToText(articles)
return p._main(text)
end
function p._main(text, style)
return mw.html.create('div')
:css('font-style', 'italic')
:css('font-size', '15px')
:css('padding-left', '2em')
:css('margin-bottom', '0.5em')
:cssText(style)
:wikitext(text)
end
return p