Modulo:Criteri cancellazione immediata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
aggiungo virgolette |
caricamento dinamico della configurazione; entrypoint per ottenere i valori di default; altre migliorie |
||
Riga 6:
require('strict')
-- oppure Modulo:Criteri cancellazione immediata/sandbox/Configurazione.json
local cfg = mw.loadJsonData(mw.getCurrentFrame():getTitle() .. '/Configurazione.json')
-- =============================================================================
Riga 117 ⟶ 118:
end
end
elseif key == 'getDefault' then
return function ()
return t.DROPDOWN_LIST
end
end
Riga 146 ⟶ 151:
end
end
end
elseif key == 'getDefault' then
return function ()
return t.SYSTEM_MESSAGE
end
end
Riga 323 ⟶ 332:
local function get_args(frame)
local args = require('Module:Arguments').getArgs(frame, { parentOnly = true })
if args[1] and args.criterio == nil then
Riga 330 ⟶ 339:
args.ns = Namespace.findByName(args.ns) or Namespace.findById(args.ns) or Namespace.DEFAULT
args['tipo elenco'] = ListType.findByArg(args['tipo elenco']) or ListType.
args['tipo testo'] = TextType.findByArg(args['tipo testo']) or TextType.
args.link = args.link ~= 'no' and true or false
args.ancore = (args.ancore == 'sì' or args.ancore == 'si') and true or false
Riga 344 ⟶ 353:
local p = {}
function p.get_default_list_type()
return ListType.getDefault()
end
function p.get_default_text_type()
return TextType.getDefault()
end
function p.get_list_types()
Riga 349 ⟶ 366:
for _, list_type in pairs(ListType) do
table.insert(list_types, string.format('"%s"'
end
Riga 359 ⟶ 376:
for _, text_type in pairs(TextType) do
table.insert(text_types, string.format('"%s"'
end
Riga 370 ⟶ 387:
local ns, criterion_code, add_link = args.ns, args.criterio, args.link
if criterion_code
▲ end
criterion:setCurrentNs(ns):setAddLink(add_link)
▲ local criterion = to_criterion(criterion_code, cfg[criterion_code])
return criterion[text_type.get](criterion)▼
end
▲ return criterion[text_type.get](criterion)
end
end
Riga 404 ⟶ 419:
for _, criterion in ipairs(valid_criteria) do
list =
if add_anchor then
list =
end
|