Modulo:Criteri cancellazione immediata/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
creazione sandbox
 
aggiorno
Riga 21:
self.abbreviation = abbreviation
self.order = { default = 0 }
self.short_texttext = { singolare = { default = '' }, plurale = { default = '' } }
self.long_text = { default = '' }
self.validity = { default = true }
 
Riga 36 ⟶ 35:
end
 
function Criterion:getShortTextgetText(ns, grammatical_number, add_link)
returnlocal text = self.short_texttext[grammatical_number][ns] or self.short_texttext[grammatical_number].default
end
 
if add_link then
function Criterion:getLongText(ns)
text = string.format('([[WP:IMMEDIATA|%s]]) %s', self:getAbbreviation(), text)
return self.long_text[ns] or self.long_text.default
end
 
return text
function Criterion:getText(ns, text_type)
if text_type == 'completo' then
return self:getLongText(ns)
elseif text_type == 'breve' then
return self:getShortText(ns)
end
end
 
Riga 72 ⟶ 65:
end
 
function Criterion:setShortTextsetText(short_texttext, ns, grammatical_number)
self.short_texttext[grammatical_number][ns] = short_texttext
end
 
function Criterion:setLongText(long_text, ns)
self.long_text[ns] = long_text
end
 
Riga 97 ⟶ 86:
end
 
if type(props.wikitestotesto) == 'stringtable' then
if type(props.testo.singolare) == 'string' then
criterion:setShortText(props.wikitesto, ns)
criterion:setText(props.testo.singolare, ns, 'singolare')
end
end
 
if type(props.testo_lungotesto.plurale) == 'string' then
criterion:setLongTextsetText(props.testo_lungotesto.plurale, ns, 'plurale')
end
end
 
Riga 124 ⟶ 115:
end
 
local function get_criterion(criterion_abbreviation, ns, text_type, add_link)
for key, value in pairs(cfg) do
local criterion = to_criterion(key, value)
 
if criterion:getAbbreviation() == criterion_abbreviation then
return criterion:getText(ns, text_type, add_link)
end
end
Riga 144 ⟶ 135:
end
 
local function list_criteria(ns, list_type, text_type, add_link)
local list = ''
local valid_criteria = {}
Riga 168 ⟶ 159:
for _, criterion in ipairs(valid_criteria) do
list = string.format('%s\n%s %s',
list, get_list_prefix(list_type), criterion:getText(ns, text_type, add_link))
end
 
Riga 186 ⟶ 177:
function p.main(frame)
local args = getArgs(frame, { parentOnly = true })
local ns, list_type, text_type, add_link, criterion_abbreviation
 
if args.ns == 'Principale' then
Riga 202 ⟶ 193:
end
 
if args['tipo testo'] == 'completosingolare' or args['tipo testo'] == 'breveplurale' then
text_type = args['tipo testo']
else
text_type = 'brevesingolare'
end
 
if text_typeargs['link'] == 'completono' then
add_link = false
else
add_link = true
end
 
if args['.criterio'] and args['.criterio'] ~= '' then
criterion_abbreviation = args['.criterio']
end
 
Riga 215 ⟶ 212:
return
elseif criterion_abbreviation then
return get_criterion(criterion_abbreviation, ns, text_type, add_link)
else
return list_criteria(ns, list_type, text_type, add_link)
end
end