Modulo:Immagine sinottico/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nuova sandbox
 
Omega Bot (discussione | contributi)
m Bot: rimuovo no globals obsoleto
 
(2 versioni intermedie di un altro utente non mostrate)
Riga 3:
]]--
 
require('Modulo:No globalsstrict')
 
local getArgs = require('Modulo:Arguments').getArgs
local mWikidata = require('Modulo:Wikidata')
local catCompatibile = '[[Categoria:Sinottici con immagini formattate a mano]]'
local catNonCompatibile = '[[Categoria:Sinottici con immagini con formattazione ridondante]]'
local catDidascalia = '[[Categoria:Voci con template Immagine sinottico con didascalia e immagine letta da Wikidata]]'
local p = {}
Line 15 ⟶ 16:
math.min(args.dim_utente, args.dim_max or args.dim or 260) or
(args.dim or 260)
return string.format('[[File:%s|frameless|center|%sx%spx%s%s]]',
file, dim, args.dim_vert_max or 300,
args.alt and '|alt=' .. args.alt or ''),
return args[1] args.. (args[2]desc and ('<br />|' .. args[2]).desc or '') .. cat
end
 
Line 24 ⟶ 26:
local userval, wdval, ret
 
-- evita letture indesiderate da wikidata
-- con args.compatibile restituisce direttamente args[1] e args[2]
if args.compatibile and args[1] and== args[1]:sub(1,'no' 1)then ==return '[' thenend
 
local cat = mw.title.getCurrentTitle().namespace == 0 and catCompatibile or ''
-- controllo quadre in eccesso
return args[1] .. (args[2] and ('<br />' .. args[2]) or '') .. cat
if args[1] and args[1]:sub(1, 1) == '[' then
local catns0 = mw.title.getCurrentTitle().namespace == 0 and catCompatibile or ''
-- con args.compatibile restituisce direttamente args[1] e args[2]
if args.compatibile then
local cat = ns0 and catCompatibile or ''
return args[1] .. (args[2] and ('<br />' .. args[2]) or '') .. cat
elseif ns0 then
ret = catNonCompatibile
end
end
 
Line 43 ⟶ 54:
-- formatta l'immagine
if userval or wdval then
ret = (ret or '') .. formatImage(userval or wdval, args)
end