Modulo:Bozza: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
riorganizzo codice
semplifico
Riga 97:
function p.main(frame)
local current_title = mw.title.getCurrentTitle()
local ns = current_title.namespace
local text = current_title:getContent()
 
if current_title.namespacens == 0 then
return '[[Categoria:Rimuovere template Bozza]]'
elseif not text then
Line 109 ⟶ 110:
local args = getArgs(frame, { parentOnly = true })
local lang = mw.language.getContentLanguage()
local state = lang:ucfirst(args[1] or '')
local submissions = getSubmissions({ current = {}, old = {} }, text)
local stateargs[1] = lang:ucfirst(args[1] or '')
 
if stateargs[1] ~= 'S' then
if next(submissions.current) then
stateargs[1] = 'R'
elseif next(submissions.old) and stateargs[1] ~= 'A' then
stateargs[1] = 'N'
end
end
 
local history_table
 
if next(submissions.old) then
Line 128 ⟶ 127:
args = { src = 'Modulo:Bozza/styles.css' }
}
local collapsed_submissions
local header = createRow('Data richiesta', 'Esito revisione')
:addClass('nomobile bozza-history-header')
local collapsed_submissionshistory_table = mw.html.create('div')
:addClass('nomobile mw-collapsible mw-collapsed')
:attr('data-expandtext', 'mostra richieste precedenti')
:attr('data-collapsetext', 'nascondi richieste precedenti')
 
history_table = mw.html.create('div')
:addClass('bozza-history')
:node(header)
Line 143 ⟶ 138:
 
if success then
i = i + 1#a
 
if i ==> 21 and not collapsed_submissions then
history_table collapsed_submissions = mw.html.create('div')
:addClass('nomobile mw-collapsible mw-collapsed')
:attr('data-expandtext', 'mostra richieste precedenti')
:attr('data-collapsetext', 'nascondi richieste precedenti')
history_table:node(collapsed_submissions)
end
Line 151 ⟶ 150:
for _, submission in ipairs(a) do
submission = submission:gsub('%}%}$', '|mostra esito=x}}')
local root = i > 1 and collapsed_submissions or history_table
local row = root:node(createRow(jFY, frame:preprocess(submission)))
root:node(row)
end
end
end
 
history_tableargs['cronologia revisioni'] = styles .. tostring(history_table)
end
 
return frame:expandTemplate{
title = 'Template:Bozza/avviso',
args = {args
} } .. (current_title.namespacens == 118 and checkForCategories(text) or '')
state,
arg = args.arg or args.arg1,
arg2 = args.arg2,
ts = args.ts,
['cronologia revisioni'] = history_table
} } .. (current_title.namespace == 118 and checkForCategories(text) or '')
end