
Questo è un modulo scritto in Lua. Le istruzioni che seguono sono contenute nella sottopagina Modulo:Cassetto/man (modifica · cronologia)
Sandbox: Modulo:Cassetto/sandbox (modifica · cronologia) · Test: Modulo:Cassetto/test (modifica · cronologia · Esegui)
Vedi anche
--[[ Source script: https://it.wikivoyage.org/wiki/Modulo:Cassetto Maintainer: Andyrom75 ]] local function _templateStyle( frame, src ) return frame:extensionTag( 'templatestyles', '', { src = src } ) end local function _isDefined(s) return s ~= '' and s end local p={} function p.Cassetto( frame ) local args={} if frame == mw.getCurrentFrame() then args = frame:getParent().args else args = frame end local html = mw.html.create( 'div' ) :addClass( 'cassetto mw-collapsible' ) if not _isDefined( args.aperto ) then html:addClass( 'mw-collapsed' ) end if _isDefined( args.larghezza ) then html:cssText( 'width:' .. args.larghezza ) end html:cssText( 'background:' .. (_isDefined( args.coloresfondo ) or '#FFFFFF') .. '; color:inherit' ) if _isDefined( args.affiancabile ) then html:cssText( 'clear:none' ) end local allineamento = 'margin-left:auto;margin-right:auto' if _isDefined( args.allineamento ) then if args.allineamento == 'sinistra' then allineamento = 'float:left' elseif args.allineamento == 'destra' then allineamento = 'float:right' end end html:cssText( allineamento ) local nodo = mw.html.create() local livello = 0 if tonumber(args.livello ) then livello = math.floor( args.livello ) if (livello > 0) and (livello < 7) then nodo:node('<H'..livello..'>') end end nodo:wikitext( args[1] or args.titolo or '' ) if (livello > 0) and (livello < 7) then nodo:node('</H'..livello..'>') end html:cssText( _isDefined( args.senzabordo ) and 'border:0' or 'border:1px solid #AAAAAA' ) :tag('div') :addClass( 'titolo' ) :cssText( 'background:' .. (_isDefined( args.colore ) or '#EFEFEF') .. '; color:inherit' ) :node( nodo ) :done() :tag('div') :addClass( 'mw-collapsible-content' ) :cssText( 'background-color:' .. (_isDefined( args.coloresfondo ) or '#FFFFFF') .. '; color:inherit' ) :wikitext( args[2] or args.testo or args.contenuto or '' ) return _templateStyle( frame, 'Cassetto/styles.css' ) .. tostring(html) end return p