Modulo:Webarchive/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
fix vari |
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
local nmonth = month_localized[tonumber(month)]
if not nmonth then return year end
local zday = day
day = zday:match("0*(%d+)")
Riga 360 ⟶ 354:
--[[--------------------------< parseExtraArgs >-----------------------
Parse numbered arguments
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
urlx
Returns the parsed table
]]
Riga 383 ⟶ 377:
ulx[indx]["date"] = args["date" .. i] or args["data" .. i]
if not ulx[indx]["date"] then
ulx[indx]["date"] = inlineRed("
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 =
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 =
elseif url_main.title and not url_main.date then -- Title. No date.
sand = mw.ustring.format("[%s %s]%s"
elseif url_main.title and url_main.date then -- Title. Date.
sand = mw.ustring.format("[%s %s]%s (%s %s)"
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: "
end
local sand = displayheader
Riga 496 ⟶ 490:
archive_ouptut[#archives_output+1] = mw.ustring.format("[%s %s]", urlx["url"], displayfield )
end
sand =
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:
})
local tname = "Webarchive"
local verifydates = "yes"
-- URL argument (first)
local url1 = args.url or args.url1
if not url1 then
return inlineError("url", "
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
if format == "addlpages" then
if not url_main.date then
format = "none"
end
elseif format
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:
track["Category:Webarchive template errors"] = 1
end
|