Dokumentationen för denna modul kan skapas på Modul:Quickbar/dok
local quickbar = {} local function is_defined(s) if s and s ~= '' then return s end return nil end function quickbar.Quickbar_header ( frame ) if frame == mw.getCurrentFrame() then args = frame:getParent().args else args = frame end if is_defined(args[1]) then local output = mw.html.create('tr') output :tag('td') :attr('colspan', is_defined(args['colspan']) or '2') :addClass('qbHeader') :wikitext(args[1] or '') return tostring(output) end return nil end function quickbar.Quickbar_site ( frame ) -- Assumo la chiamata mediante #invoke, quindi usa gli argomenti passati al template invocante. args = frame:getParent().args if is_defined(args[1]) and is_defined(args[2]) then return quickbar.Quickbar_header{'['..args[2]..' <small>'..args[1]..'</small>]'} end return nil end function quickbar.Quickbar_item ( frame ) args = frame:getParent().args if is_defined(args[1]) and is_defined(args[2]) then local output = mw.html.create('tr') output :tag('th') :addClass('qbRowHeader') :wikitext(args['heading'] or args[1] or '') :done() :tag('td') :addClass('printNoLink qbRowValue') :wikitext(args['value'] or args[2] or '') return tostring(output) end return nil end function quickbar.Quickbar_image ( frame ) if frame == mw.getCurrentFrame() then args = frame:getParent().args else args = frame end if args == nil then return nil end local heading = mw.html.create('') if is_defined(args['heading']) then heading :tag('div') :addClass('qbHeader') :wikitext(args['heading']) :done() end local output = mw.html.create('tr') output :tag('td') :attr('colspan', is_defined(args['colspan']) or '2') :addClass('qbImageCell') :node(heading) :tag('div') :addClass('qbImage') :wikitext(args['image'] or '') return tostring(output) end function quickbar.coa_and_flag ( frame ) local Wikibase = require('Module:Wikibase') local stemma = Wikibase.vapen() local stemma_titolo = Wikibase.vapen_titel() local wikistemma = '[[File:'..stemma..'|70x70px|center|'..stemma_titolo..']]' local bandiera = Wikibase.flagga() local bandiera_titolo = Wikibase.flagga_titel() local wikibandiera = '[[File:'..bandiera..'|70x70px|center|border|'..bandiera_titolo..']]' --Mostra stemma e bandiera affiancate quando entrambe presenti, o il solo stemma se la bandiera è mancante if is_defined(stemma) then if is_defined(bandiera) then return quickbar.Quickbar_image{ heading='Vapen & Flagga', image='<table width="100%"><tr><td witdh="50%">'..wikistemma..'</td><td witdh="50%">'..wikibandiera..'</td></tr></table>' } else return quickbar.Quickbar_image{ heading='Vapen', image=wikistemma } end --Mostra la sola bandiera quando lo stemma è mancante elseif is_defined(bandiera) then return quickbar.Quickbar_image{ heading='Flagga', image=wikibandiera } end return nil end return quickbar