Modulo:Citazione/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
ripristino da Modulo:Citazione del 17 apr 2018 alle 12:46 |
|||
Riga 9:
error_categories = {}; -- lista delle categorie di errore
error_ids = {}; -- lista dei codici di errore
message_tail = {}; --
}
Riga 15:
Caricamente delle tabelle di configurazione del modulo.
===============================================================================]]
local cfg = mw.loadData( 'Modulo:Citazione/Configurazione
--[[ ===============================================================================
Riga 759:
local function anchor_id( options )
return "CITEREF" .. table.concat( options );
end▼
if not is_set( v ) then▼
end▼
end▼
return list▼
end
Riga 878 ⟶ 857:
return new_list;
▲end
--[[ ===============================================================================
Genera la stringa per il formato, se format non è definita tenta di ricavarlo dall'url
===============================================================================]]
local function get_format(format, url)
local try_format = format
if not cfg.external_link_type[try_format:lower()] then▼
try_format = mw.ustring.match(try_format, "^(.+)#.+$") or ''
end▼
▲ end
▲ end
-- Se il formato esterno è tra quelli previsti imita lo stile dei template {{PDF}} o {{doc}}▼
local f = cfg.external_link_type[try_format:lower()]
else▼
end▼
end
Riga 1 052 ⟶ 1 057:
-- local Agency = A['Agency'];
local DeadURL = A['DeadURL']
local Language = A['Language'];
local Format = A['Format'];
local Ref = A['Ref'];
Riga 1 257 ⟶ 1 261:
end
-- genera la stringa per il formato
▲ local try_format = mw.ustring.match( (is_set(ChapterURL) and ChapterURL) or URL, "^.*%.(.+)$" ) or ''
▲ if cfg.external_link_type[try_format:lower()] then
▲ end
▲ -- Se il formato esterno è tra quelli previsti imita lo stile dei template {{PDF}} o {{doc}}
▲ local f = cfg.external_link_type[Format:lower()]
▲ if f then
▲ Format = mw.ustring.format(' (<span style="font-weight: bolder; font-size:80%%"><abbr title="%s">%s</abbr></span>)', f.text, f.label)
▲ table.insert( z.message_tail, { set_error('unknown_format', Format, true) } );
▲ Format = mw.ustring.format(' (%s)', Format)
▲ else
end▼
-- In maniera predefinita l'URL non è dichiarato morto
Riga 1 394 ⟶ 1 380:
---------------------------------------------------------------
local Language_code = ""
if is_set(Language
if Language:sub(1,1) == "(" then
Language_code = Language
Riga 1 400 ⟶ 1 386:
local frame_lingue = {return_error='true', usacodice='sì'}
for lingua in mw.ustring.gmatch(Language, "%S+") do
▲ end
frame_lingue[#frame_lingue+1] = lingua
end
Riga 1 735 ⟶ 1 718:
rows[#rows+1] = "|}"
return table.concat(rows, '\n')
-- per formati esterni da altri template
function z.format(frame)
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame, {frameOnly = true})
return get_format(args[1])
end
|