Modulo:Webarchive/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
fix vari
Moroboshi (discussione | contributi)
Nessun oggetto della modifica
Riga 188:
local zmonth = month -- month with leading 0
month = month:match("0*(%d+)") -- month without leading 0
if tonumber(month) < 1 or tonumber(month) > 12 then return year end
return year
end
--local nmonth = os.date("%B", os.time{year=2000, month=month, day=1} ) -- month in name form
local nmonth = month_localized[tonumber(month)]
if not nmonth then return year end
return year
end
 
local zday = day
day = zday:match("0*(%d+)")
Riga 360 ⟶ 354:
--[[--------------------------< parseExtraArgs >-----------------------
 
Parse numbered arguments starting atfrom 2 to maxurls, such as url2..url10, date2..date10, title2..title10
e memorized them in a table
For example: {{webarchive |url=.. |url4=.. |url7=..}}
Three url arguments not in numeric sequence (1..4..7).
Function only processes arguments numbered 2 or greater (in this case 4 and 7)
It creates numeric sequenced table entries like:
urlx.url2[1].url = <argument value for url4>
urlx.url3[2].url = <argument value for url7>
Returns the parsed table
Returns the number of URL arguments found numbered 2 or greater (in this case returns "2")
 
]]
 
Riga 383 ⟶ 377:
ulx[indx]["date"] = args["date" .. i] or args["data" .. i]
if not ulx[indx]["date"] then
ulx[indx]["date"] = inlineRed("[&91;Data mancante]&93;", "warning")
end
ulx[indx]["title"] = args["title" .. i] or args["titolo" .. i]
Riga 454 ⟶ 448:
if url_main.format == "none" then
if not url_main.title and not url_main.date then -- No title. No date
sand = "[" mw.ustring. url_main.url .. format("[%s Archiviato]%s", url_main..url, url_main.tail)
elseif not url_main.title and url_main.date then -- No title. Date.
if url_main.service == "wayback" then
Riga 460 ⟶ 454:
period2 = ""
end
sand = "[" mw.ustring. url_main.url .. format("[%s Archiviato] il %s%s%s%s", url_main..url, url_main.date .., comma(url_main.date) .., url_main.tail .., period1)
elseif url_main.title and not url_main.date then -- Title. No date.
sand = mw.ustring.format("[%s %s]%s" .., url_main.url .. " " .., url_main.title .. "]" .., url_main.tail)
elseif url_main.title and url_main.date then -- Title. Date.
sand = mw.ustring.format("[%s %s]%s&#32;(%s %s)" .., url_main.url .. " " .., url_main.title .. "]" .., url_main.tail .. "&#32;(" .., indexstr .. " " .., url_main.date .. ")"
else
return nil
Riga 483 ⟶ 477:
displayheader = "Archivi aggiuntivi: "
else -- Multiple pages from the same archive
displayheader = mw.ustring.format("Pagine di archivio aggiuntive su %s: " .., url_main.date .. ": ")
end
local sand = displayheader
Riga 496 ⟶ 490:
archive_ouptut[#archives_output+1] = mw.ustring.format("[%s %s]", urlx["url"], displayfield )
end
sand = sand mw.ustring.format("%s%s.", sand, table.concat(archive_output, ", ") .. ".")
return sand
end
end
 
--[[--------------------------< createRendering >-----------------------
 
Funzione di interfaccia principale per implementazione di
template:Webarchive
 
]]
 
function p.webarchive(frame)
-- carico in args i parametri, se sono nulli sono ignorati, eccetto che per il prametro nolink
local args = getArgs(frame, {
valueFunc = function (key, value)
Riga 514 ⟶ 516:
})
 
-- if (args[1]==nil) and (args["url"]==nil) then -- if no argument provided than check parent template/module args
-- args = frame:getParent().args
-- end
 
local tname = "Webarchive" -- name of calling template. Change if template rename.
local verifydates = "yes" -- See documentation. Set "no" to disable.
 
-- URL argument (first)
local url1 = args.url or args.url1
if not url1 then
return inlineError("url", "Emptyvuoto.") .. createTracking()
end
if mw.ustring.find( url1, "https://web.http") then -- track bug
Riga 572 ⟶ 571:
date = inlineRed("[Data mancante]", "warning")
elseif not date then
date = inlineRed("[Date error] (1)]", "error")
end
elseif not date then
Riga 580 ⟶ 579:
 
-- Format argument
local format = args.format or args.formato or "none"
if not format ~= "none" then
format = "none"
else
if format == "addlpages" then
if not url_main.date then
format = "none"
end
elseif format =~= "addlarchives" then
format = "addlarchives"
else
format = "none"
end
Riga 602 ⟶ 597:
local rend = createRendering(url_main, ulx)
if not rend then
rend = mw.ustring.format('<span style="font-size:100%" class="error citation-comment">Errori in [[:Template:' .. tname .. '%s]]: Problema sconosciuto. Si prega di segnalarlo nella [[Discussioni_template:' .. tname .. '%s|pagina di discussione]] del template.</span>', tname, tname)
track["Category:Webarchive template errors"] = 1
end