Modulo:Webarchive/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m taglio formati inutili in italiano |
-codice obsoleto o inutile per l'italiano |
||
Riga 88:
elseif c >= 97 and c <= 122 then
c = c - 61
else
r = 1
break
end
r = r + c * k
k = k * 62
end
end
return r
Riga 152:
--[[--------------------------< decodeWebciteDate >-----------------------
Ricava la data da un URI-path a Webcite (es. /67xHmVFWP).
Restituisce false se l'URL è valido ma in formato senza data.
]]
function p.decodeWebciteDate(path)
Line 169 ⟶ 170:
mw.ustring.find(path_elements[2], "getfile") or
tonumber(path_elements[2]) then
return
end
local snapdate = os.date("%Y %m %d", string.sub(string.format("%d", base62(path_elements[2])),1,10))
local dt = mw.text.split(snapdate, " ")
local fulldate = formatUrlDate(dt[1], dt[2], dt[3])
return fulldate
end
--[[--------------------------< snapDateToString >-----------------------
Ricava la data da un URI-path a Wayback (es. /web/20160901010101/http://example.com ).
Gestisce anche le non cifre come "re_", "-" e "*".
]]
function p.decodeWaybackDate(path)
Line 185 ⟶ 186:
local path_elements = mw.text.split(snapdate, "/")
snapdate = path_elements[1]
if snapdate == '*' then return end
end▼
snapdate = string.gsub(snapdate, "[a-z][a-z]_[0-9]?$", "")
snapdate = string.gsub(snapdate, "[-]", "")
Line 199 ⟶ 198:
fulldate = formatUrlDate(year, month, day)
end
return fulldate
end
Line 257 ⟶ 256:
end
return ulx
return ","▼
else▼
return ""▼
end
--[[--------------------------< createTracking >-----------------------
Restituisce
]]
local function createTracking()
--
local current_namespace = mw.title.getCurrentTitle().namespace
if current_namespace ~= 0 then return '' end
Line 301 ⟶ 286:
indexstr = "archivio"
end
if url_main.format == "none" then▼
▲ sand = mw.ustring.format("[%s Archiviato]%s", url_main.url, url_main.tail)
elseif not url_main.title and url_main.date then -- No title. Date.▼
▲ period1 = "."
▲ period2 = ""
sand = mw.ustring.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.▼
end
▲
sand = sand .. period2 .. " Archivi aggiuntivi: "▼
else
▲ end
local archives_output = {}
for indx,
▲ archive_ouptut[#archives_output+1] = mw.ustring.format("[%s %s]", urlx["url"], displayfield )
end
sand =
end
end
--[[--------------------------
Funzione di interfaccia principale per implementazione del
Template:Webarchive
]]
function p.webarchive(frame)
--
local args = getArgs(frame, {
valueFunc = function(key, value)
Line 369 ⟶ 330:
})
--
local url1 = args.url or args.url1
if not url1 then
return inlineError(
elseif mw.ustring.find(url1,
track[
return inlineError(
elseif url1 ==
track[
return inlineError(
end
local url_main = {}
url_main.url = url1
Line 387 ⟶ 347:
serviceName(url_main, args.nolink)
--
local date = args.date or args.date1 or args.data or args.data1
date = formatDate(date)
local udate = url_main.service == 'wayback' and p.decodeWaybackDate(
url_main.service == 'webcite' and p.decodeWebciteDate(
if udate and udate ~= date then
date =
end
elseif
date = p.decodeWaybackDate(
elseif
date = p.decodeWebciteDate(
if date ==
date = inlineRed(
elseif not date then
date = inlineRed(
end
▲ else
▲ elseif not date then
date = inlineRed(
end
url_main.date = date
--
url_main.title = args.title or args.title1 or args.titolo or args.titolo1
local ulx = parseExtraArgs(args, maxurls)
local rend = createRendering(url_main, ulx)
if not rend then
|