Модуль:UBox
Внешний вид
Для документации этого модуля может быть создана страница Модуль:UBox/doc
local p = {}
function p.box( f )
local args = require( 'Module:ProcessArgs' ).merge( true )
local msgbox = {}
local page = mw.title.getCurrentTitle()
local typebox = args["тип"] or 'ubox'
if typebox == 'ubox' then
if page.isContentPage then
typebox = 'ubox ambox'
else
typebox = 'ubox msgbox'
end
end
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 nocat = args["некат"]
local cat = args["категория"]
local doc = args["док"]
if (not nocat and cat) then
cat = '[[Категория: ' .. mw.ustring.gsub( cat, ';', ']][[Категория:' ) .. ']]'
if (doc and page.subpageText ~= 'док') then
cat = ''
elseif (not doc and page.subpageText == 'док') then
cat = ''
end
else
cat = ''
end
local image = args["изобр"] or args["image"] or ''
local imgClass = 'ubox-img-table'
if image ~= '' then
image = '[[Файл:' .. image .. '|48px]]'
imgClass = 'ubox-img-hand'
end
table.insert( msgbox, ' {| class="' .. typebox ..' ' .. class .. '" ')
table.insert( msgbox, '|-\n| class="ubox-img ' .. imgClass .. '"| <div>' .. image .. '</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