Модул:Infobox и Модул:Пясъчник: Разлика между страниците

(Разлики между страниците)
Изтрито е съдържание Добавено е съдържание
нови редове след завършване на клетките, за да не води до счупване на списъци; при > 1 от даден тип
 
Редакция без резюме
Етикет: Отменени
 
Ред 36:
table.sort(nums)
return nums
end
 
local function commonsBelow()
local commons
local entity = mw.wikibase.getEntity()
local pagetitle = mw.title.getCurrentTitle().text
local success, val = pcall(function() return entity['claims']['P373'][1]['mainsnak']['datavalue']['value'] end) -- Commons category property value
if success then
commons = 'Category:' .. val
else
success, val = pcall(function() return entity['claims']['P935'][1]['mainsnak']['datavalue']['value'] end) -- Commons gallery property value
if success then
commons = val
else
success, val = pcall(function() return entity['sitelinks']['commonswiki']['title'] end) -- Commons link value from multilanguage sites links menu
if success then commons = val end
end
end
if commons and pagetitle then
return '<b class="plainlinks">[' .. tostring(mw.uri.fullUrl(':c:' .. commons, 'uselang=bg')) .. ' ' .. mw.ustring.gsub(pagetitle, "%s+%b()$", "") .. ']</b> в [[Общомедия]]'
end
return nil
end
 
Line 124 ⟶ 148:
 
local function renderBelowRow()
if args.child or args.subbox then
args.below = args.below
else
args.below = args.below or commonsBelow() -- get commons only when an infobox doesn't have subbox/child params
end
if not args.below then return end
 
Line 366 ⟶ 395:
-- another parameter are only processed if that parameter is present, to avoid
-- phantom references appearing in article reference lists.
args['child'] = origArgs['child'] -- could be blank or absent; different behaviour because of below
preprocessSingleArg('child')
preprocessSingleArg('bodyclass')
args['subbox'] = origArgs['subbox'] -- could be blank or absent; different behaviour because of below
preprocessSingleArg('subbox')
preprocessSingleArg('bodystyle')
preprocessSingleArg('title')