Модуль:UBox
Внешний вид
Для документации этого модуля может быть создана страница Модуль:UBox/doc
local p = {}
function p.box( f )
local args = require( 'Module:ProcessArgs' ).merge( true )
local msgbox = {}
local type = args["тип"] or 'ubox'
local class = args["класс"] or 'ubox-default'
local title = args["назв"] or ''
local text = args["текст"] or ''
local smalltext = args["примечание"] or args["опись"] or ''
local talkPage = args["стробс"] or 'Обсуждение Minecraft Wiki:Портал сообщества'
local talk = ''
local talkTheme = args["тема"] or ''
if talkTheme ~= '' then
talk = '<sup>[[' .. talkPage .. '#' .. talkTheme .. '|Обсуждение]]</sup>'
end
local doc = args["док"]
local isDocpage
local nocat = args["некат"]
if doc then
isDocpage = f:getTitle().subpageText == 'док'
end
nocat = nocat or (doc ~= isDocpage)
local cat = args["категория"]
if (not nocat and cat) then
cat = mw.ustring.gsub( cat, ';', ']][[Категория:' )
cat = '[[Категория: ' .. cat .. ']]'
else
cat = ''
end
table.insert( msgbox, ' {| class="' .. type ..' ' .. class .. '" ')
table.insert( msgbox, '|-\n| class="ubox-img"| <div></div>')
table.insert( msgbox, '| class="ubox-field"| <span class="ubox-title">' .. title .. talk .. '</span>\n<div class="ubox-text">' .. text .. '</div>')
if smalltext ~= '' then
table.insert( msgbox, '|-\n| colspan=2 class="ubox-summary"|\n' .. smalltext )
end
table.insert( msgbox, '|} ' .. cat)
msgbox = table.concat( msgbox, '\n' )
return msgbox
end
return p