Modulo:Bozza: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
+
aggiorno
Riga 2:
 
local p = {}
local getArgs = require('Module:Arguments').getArgs
 
local function removeFalsePositivesreplace(str, pattern, replace)
local i, j = str:find(pattern, 1, true)
str = str:sub(0, i - 1) .. replace .. str:sub(j + 1)
return str
:gsub('<!%-%-.-%-%->', '')
:gsub('<nowiki>.-</nowiki>', '')
:gsub('%{%{ *[Cc]ategorie *bozza *%|.-%}%}', '')
end
 
local function getPageContentgetSubmissions(stored_submissions, text)
local declinednew_text = falsetext
local text = mw.title.getCurrentTitle():getContent() or ''
 
for colonprefixtmp in text:gmatch(pattern'%{(%b{})%}') do
return removeFalsePositives(text)
local old_tmp = tmp
end
stored_submissions, tmp = getSubmissions(stored_submissions, tmp)
new_text = replace(new_text, old_tmp, tmp)
 
for if str in texttmp:gmatchmatch('%{^%{ *[Rr]ichiesta *revisione *bozza *([%|.-%})%}]') dothen
function p.controllo_categorie(frame)
local textrequest = getPageContentstring.format('{%s}', tmp)
new_text = replace(new_text, request, '')
local pattern = "%[%[ *([Cc][Aa][Tt][Ee][Gg][Oo][Rr][YyIi][Aa]?) *: *[^%s][^\n]-%]%]"
tmp = tmp:gsub('%{%b{}%}', '{{')
 
if strtmp:findmatch('%| *1? *=? *respinta[^%s%|%}]') or tmp:match('%| *esito *= *[^%s%|%}]') then
for colonprefix in text:gmatch(pattern) do
table.insert(stored_submissions.old, request)
local ns = mw.site.namespaces[colonprefix]
else
 
table.insert(stored_submissions.current, request)
if ns and ns.canonicalName == 'Category' then
end
return '[[Categoria:Bozze con categorie da disabilitare]]'
end
end
 
return stored_submissions, new_text
end
 
function p.stato_richiestamain(frame)
local textcurrent_title = mw.title.getCurrentTitle():getContent() or ''
if frame.args[1] == 'S' then return frame.args[1] end
 
if current_title.namespace == 0 then
local text = getPageContent()
return '[[Categoria:Rimuovere template Bozza]]'
local declined = false
end
local lang = mw.language.getContentLanguage()
 
local text = current_title:getContent()
for str in text:gmatch('%{%{ *[Rr]ichiesta *revisione *bozza *(%|.-%})%}') do
if str:find('%| *1? *=? *respinta *[%|%}]') then
declined = true
else
local ts = str:match('| *ts *= *(%d%d%d%d%d%d%d%d%d%d%d%d%d%d) *[%|%}]')
 
if not text then return end
if ts and pcall(lang.formatDate, lang, '', ts) == true then
 
return 'R'
text
end
:gsub('<!%-%-.-%-%->', '')
:gsub('<nowiki>.-</nowiki>', '')
:gsub('%f[%{]%{%f[^%{]', '\r')
:gsub('%{%{ *[Cc]ategorie *bozza *%|.-%}%}', '')
 
local args = getArgs(frame, { parentOnly = true })
local lang = mw.language.getContentLanguage()
local state = lang:ucfirst(args[1] or '')
local submissions = getSubmissions({ current = {}, old = {} }, text)
 
if declinedstate ~= 'S' then
if #submissions.current > 0 then
returnstate = 'R'
elseif #submissions.old > 0 and state ~= 'A' then
state = 'N'
end
end
 
local ret = frame:expandTemplate{
if declined then
title = 'Template:Bozza',
return frame.args[1] == 'A' and 'A' or 'N'
args = { state, ts = args.ts }
}
 
if current_title.namespace == 118 then
local patterncatpattern = "%[%[ *([Cc][Aa][Tt][Ee][Gg][Oo][Rr][YyIi][Aa]?) *: *[^%s][^\n]-%]%]"
 
for colonprefix in text:gmatch('%[%[ *(' .. catpattern .. ') *: *[^%s][^\n]-%]%]') do
local ns = mw.site.namespaces[colonprefix]
 
if ns and ns.canonicalName == 'Category' then
return ret = ret .. '[[Categoria:Bozze con categorie da disabilitare]]'
break
end
end
end
 
return frame.args[1]ret
end