Pereiti prie turinio

Module:Webarchive

Puslapis iš Vikipedijos, laisvosios enciklopedijos.

Documentation for this module may be created atModule:Webarchive/doc

--[[ ----------------------------------

Lua module implementing the {{webarchive}} template.

A merger of the functionality of three templates: {{wayback}}, {{webcite}} and {{cite archives}}

]]

localp={}

--[[--------------------------< inlineError >-----------------------

Critical error. Render output completely in red. Add to tracking category.

]]

localfunctioninlineError(arg,msg)

track["Category:Webarchive template errors"]=1
return'<span style= "font-size:100%" class= "error citation-comment" >Error in webarchive template: Check <code style= "color:inherit; border:inherit; padding:inherit;" >&#124;'..arg..'=</code> value. '..msg..'</span>'

end

--[[--------------------------< inlineRed >-----------------------

Render a text fragment in red, such as a warning as part of the final output.
Add tracking category.

]]

localfunctioninlineRed(msg,trackmsg)

iftrackmsg=="warning"then
track["Category:Webarchive template warnings"]=1
elseiftrackmsg=="error"then
track["Category:Webarchive template errors"]=1
end

return'<span style= "font-size:100%" class= "error citation-comment" >'..msg..'</span>'

end

--[[--------------------------< trimArg >-----------------------

trimArg returns nil if arg is "" while trimArg2 returns 'true' if arg is ""
trimArg2 is for args that might accept an empty value, as an on/off switch like nolink=

]]

localfunctiontrimArg(arg)
ifarg==""orarg==nilthen
returnnil
else
returnmw.text.trim(arg)
end
end
localfunctiontrimArg2(arg)
ifarg==nilthen
returnnil
else
returnmw.text.trim(arg)
end
end

--[[--------------------------< base62 >-----------------------

Convert base-62 to base-10
Credit: https://de.wikipedia.org/wiki/Modul:Expr

]]

localfunctionbase62(value)

localr=1

ifvalue:match("^%w+$")then
localn=#value
localk=1
localc
r=0
fori=n,1,-1do
c=value:byte(i,i)
ifc>=48andc<=57then
c=c-48
elseifc>=65andc<=90then
c=c-55
elseifc>=97andc<=122then
c=c-61
else-- How comes?
r=1
break-- for i
end
r=r+c*k
k=k*62
end-- for i
end
returnr
end

--[[--------------------------< tableLength >-----------------------

Given a 1-D table, return number of elements

]]

localfunctiontableLength(T)
localcount=0
for_inpairs(T)docount=count+1end
returncount
end


--[[--------------------------< dateFormat >-----------------------

Given a date string, return its format: dmy, mdy, iso, ymd
If unable to determine return nil

]]

localfunctiondateFormat(date)

localdt={}
dt.split={}

dt.split=mw.text.split(date,"-")
iftableLength(dt.split)==3then
iftonumber(dt.split[1])>1900andtonumber(dt.split[1])<2200andtonumber(dt.split[2])andtonumber(dt.split[3])then
return"iso"
else
returnnil
end
end

dt.split=mw.text.split(date,"")
iftableLength(dt.split)==3then
iftonumber(dt.split[3])then
iftonumber(dt.split[3])>1900andtonumber(dt.split[3])<2200then
iftonumber(dt.split[1])then
return"dmy"
else
return"mdy"
end
else
iftonumber(dt.split[1])then
iftonumber(dt.split[1])>1900andtonumber(dt.split[1])<2200then
return"ymd"
end
end
end
end
end
returnnil

end

--[[--------------------------< makeDate >-----------------------

Given a zero-padded 4-digit year, 2-digit month and 2-digit day, return a full date in df format
df = mdy, dmy, iso, ymd

]]

localfunctionmakeDate(year,month,day,df)

ifnotyearoryear==""ornotmonthormonth==""ornotdayorday==""then
returnnil
end

localzmonth=month-- month with leading 0
month=month:match("0*(%d+)")-- month without leading 0
iftonumber(month)<1ortonumber(month)>12then
returnyear
end
localnmonth=os.date("%B",os.time{year=2000,month=month,day=1})-- month in name form
ifnotnmonththen
returnyear
end

localzday=day
day=zday:match("0*(%d+)")
iftonumber(day)<1ortonumber(day)>31then
ifdf=="mdy"ordf=="dmy"then
returnnmonth..""..year
elseifdf=="iso"then
returnyear.."-"..zmonth
elseifdf=="ymd"then
returnyear..""..nmonth
else
returnnmonth..""..year
end
end

ifdf=="mdy"then
returnnmonth..""..day..","..year-- September 1, 2016
elseifdf=="dmy"then
returnday..""..nmonth..""..year-- 1 September 2016
elseifdf=="iso"then
returnyear.."-"..zmonth.."-"..zday-- 2016-09-01
elseifdf=="ymd"then
returnyear..""..nmonth..""..cday-- 2016 September 1
else
returnnmonth..""..day..","..year-- September 1, 2016
end

end


--[[--------------------------< decodeWebciteDate >-----------------------

Given a URI-path to Webcite (eg. /67xHmVFWP) return the encoded date in df format

]]
localfunctiondecodeWebciteDate(path,df)

localdt={}
dt.split={}

dt.split=mw.text.split(path,"/")

-- valid URL formats that are not base62

-- http://www.webcitation.org/query?id=1138911916587475
-- http://www.webcitation.org/query?url=http..&date=2012-06-01+21:40:03
-- http://www.webcitation.org/1138911916587475
-- http://www.webcitation.org/cache/73e53dd1f16cf8c5da298418d2a6e452870cf50e
-- http://www.webcitation.org/getfile.php?fileid=1c46e791d68e89e12d0c2532cc3cf629b8bc8c8e

ifmw.ustring.find(dt.split[2],"query",1,plain)or
mw.ustring.find(dt.split[2],"cache",1,plain)or
mw.ustring.find(dt.split[2],"getfile",1,plain)or
tonumber(dt.split[2])then
return"query"
end

dt.full=os.date("%Y %m %d",string.sub(string.format("%d",base62(dt.split[2])),1,10))
dt.split=mw.text.split(dt.full,"")
dt.year=dt.split[1]
dt.month=dt.split[2]
dt.day=dt.split[3]

ifnottonumber(dt.year)ornottonumber(dt.month)ornottonumber(dt.day)then
returninlineRed("[Date error] (1)","error")
end

iftonumber(dt.month)>12ortonumber(dt.day)>31ortonumber(dt.month)<1then
returninlineRed("[Date error] (2)","error")
end
iftonumber(dt.year)>tonumber(os.date("%Y"))ortonumber(dt.year)<1900then
returninlineRed("[Date error] (3)","error")
end

fulldate=makeDate(dt.year,dt.month,dt.day,df)
ifnotfulldatethen
returninlineRed("[Date error] (4)","error")
else
returnfulldate
end

end

--[[--------------------------< decodeWaybackDate >-----------------------

Given a URI-path to Wayback (eg. /web/20160901010101/http://example.com )
return the formatted date eg. "September 1, 2016" in df format
Handle non-digits in snapshot ID such as "re_" and "-" and "*"

]]

localfunctiondecodeWaybackDate(path,df)

localsnapdate,snapdatelong,currdate,fulldate

localsafe=path
snapdate=string.gsub(safe,"^/w?e?b?/?","")-- Remove leading "/web/" or "/"
safe=snapdate
localN=mw.text.split(safe,"/")
snapdate=N[1]
ifsnapdate=="*"then-- eg. /web/*/http..
return"index"
end
safe=snapdate
snapdate=string.gsub(safe,"[a-z][a-z]_[0-9]?$","")-- Remove any trailing "re_" from date
safe=snapdate
snapdate=string.gsub(safe,"[-]","")-- Remove dashes from date eg. 2015-01-01
safe=snapdate
snapdate=string.gsub(safe,"[*]$","")-- Remove trailing "*"

ifnottonumber(snapdate)then
returninlineRed("[Date error] (2)","error")
end
localdlen=string.len(snapdate)
ifdlen<4then
returninlineRed("[Date error] (3)","error")
end
ifdlen<14then
snapdatelong=snapdate..string.rep("0",14-dlen)
else
snapdatelong=snapdate
end
localyear=string.sub(snapdatelong,1,4)
localmonth=string.sub(snapdatelong,5,6)
localday=string.sub(snapdatelong,7,8)
ifnottonumber(year)ornottonumber(month)ornottonumber(day)then
returninlineRed("[Date error] (4)","error")
end
iftonumber(month)>12ortonumber(day)>31ortonumber(month)<1then
returninlineRed("[Date error] (5)","error")
end
currdate=os.date("%Y")
iftonumber(year)>tonumber(currdate)ortonumber(year)<1900then
returninlineRed("[Date error] (6)","error")
end

fulldate=makeDate(year,month,day,df)
ifnotfulldatethen
returninlineRed("[Date error] (7)","error")
else
returnfulldate
end

end

--[[--------------------------< decodeArchiveisDate >-----------------------

Given an Archive.is "long link" URI-path (e.g. /2016.08.28-144552/http://example.com)
return the date in df format (e.g. if df = dmy, return 28 August 2016)
Handles "." and "-" in snapshot date, so 2016.08.28-144552 is same as 20160828144552

]]

localfunctiondecodeArchiveisDate(path,df)

localsnapdate,snapdatelong,currdate,fulldate

localsafe=path
localN=mw.text.split(safe,"/")
safe=N[2]-- get snapshot date, e.g. 2016.08.28-144552
snapdate=string.gsub(safe,"[%.%-]","")-- remove periods and hyphens

ifnottonumber(snapdate)then-- if not numeric, it is "short link", not date
return"short link"-- e.g. http://archive.is/hD1qz
end

localdlen=string.len(snapdate)
ifdlen<4then
returninlineRed("[Date error] (3)","error")
end
ifdlen<14then
snapdatelong=snapdate..string.rep("0",14-dlen)
else
snapdatelong=snapdate
end
localyear=string.sub(snapdatelong,1,4)
localmonth=string.sub(snapdatelong,5,6)
localday=string.sub(snapdatelong,7,8)
ifnottonumber(year)ornottonumber(month)ornottonumber(day)then
returninlineRed("[Date error] (4)","error")
end
iftonumber(month)>12ortonumber(day)>31ortonumber(month)<1then
returninlineRed("[Date error] (5)","error")
end
currdate=os.date("%Y")
iftonumber(year)>tonumber(currdate)ortonumber(year)<1900then
returninlineRed("[Date error] (6)","error")
end

fulldate=makeDate(year,month,day,df)
ifnotfulldatethen
returninlineRed("[Date error] (7)","error")
else
returnfulldate
end

end


--[[--------------------------< serviceName >-----------------------

Given a domain extracted by mw.uri.new() (eg. web.archive.org) set tail string and service ID

]]

localfunctionserviceName(host,nolink)

localtracking="Category:Webarchive template other archives"

localbracketopen="[["
localbracketclose="]]"
ifnolinkthen
bracketopen=""
bracketclose=""
end

ulx.url1.service="other"
ulx.url1.tail="at"..ulx.url1.host..""..inlineRed("Error: unknown archive URL")

host=string.lower(host)

ifmw.ustring.find(host,"europarchive.org",1,plain)then-- any containing "archive.org" listed before Wayback to avoid disambiguation
ulx.url1.tail="iš"..bracketopen.."National Library of Ireland"..bracketclose
elseifmw.ustring.find(host,"webarchive.org.uk",1,plain)then
ulx.url1.tail="iš"..bracketopen.."UK Web Archive"..bracketclose
elseifmw.ustring.find(host,"archive.org",1,plain)then
ulx.url1.service="wayback"
ulx.url1.tail="iš"..bracketopen.."Wayback Machine"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Wayback nuorodos"
elseifmw.ustring.find(host,"webcitation.org",1,plain)then
ulx.url1.service="webcite"
ulx.url1.tail="iš"..bracketopen.."WebCite"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono WebCite nuorodos"
elseifmw.ustring.find(host,"archive.is",1,plain)then
ulx.url1.service="archiveis"
ulx.url1.tail="iš"..bracketopen.."Archive.is"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Archive.is nuorodos"
elseifmw.ustring.find(host,"archive.fo",1,plain)then
ulx.url1.service="archiveis"
ulx.url1.tail="iš"..bracketopen.."Archive.is"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Archive.is nuorodos"
elseifmw.ustring.find(host,"archive.today",1,plain)then
ulx.url1.service="archiveis"
ulx.url1.tail="iš"..bracketopen.."Archive.is"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Archive.is nuorodos"
elseifmw.ustring.find(host,"archive.li",1,plain)then
ulx.url1.service="archiveis"
ulx.url1.tail="iš"..bracketopen.."Archive.is"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Archive.is nuorodos"
elseifmw.ustring.find(host,"archive.ec",1,plain)then
ulx.url1.service="archiveis"
ulx.url1.tail="iš"..bracketopen.."Archive.is"..bracketclose.."projekto"
tracking="Kategorija:Webarchive šablono Archive.is nuorodos"
elseifmw.ustring.find(host,"archive[-]it.org",1,plain)then
ulx.url1.service="archiveit"
ulx.url1.tail="iš"..bracketopen.."Archive-It"..bracketclose.."projekto"
elseifmw.ustring.find(host,"arquivo.pt",1,plain)then
ulx.url1.tail="iš".."Portuguese Web Archive"
elseifmw.ustring.find(host,"loc.gov",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Library of Congress"..bracketclose
elseifmw.ustring.find(host,"webharvest.gov",1,plain)then
ulx.url1.tail="iš"..bracketopen.."National Archives and Records Administration"..bracketclose
elseifmw.ustring.find(host,"bibalex.org",1,plain)then
ulx.url1.tail="iš".."[[Bibliotheca_Alexandrina#Internet_Archive_partnership|Bibliotheca Alexandrina]]"
elseifmw.ustring.find(host,"collectionscanada",1,plain)then
ulx.url1.tail="iš".."Canadian Government Web Archive"
elseifmw.ustring.find(host,"haw.nsk",1,plain)then
ulx.url1.tail="iš".."Croatian Web Archive (HAW)"
elseifmw.ustring.find(host,"veebiarhiiv.digar.ee",1,plain)then
ulx.url1.tail="iš".."Estonian Web Archive"
elseifmw.ustring.find(host,"vefsafn.is",1,plain)then
ulx.url1.tail="iš".."[[National and University Library of Iceland]]"
elseifmw.ustring.find(host,"proni.gov",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Public Record Office of Northern Ireland"..bracketclose
elseifmw.ustring.find(host,"uni[-]lj.si",1,plain)then
ulx.url1.tail="iš".."Slovenian Web Archive"
elseifmw.ustring.find(host,"stanford.edu",1,plain)then
ulx.url1.tail="iš".."[[Stanford University Libraries|Stanford Web Archive]]"
elseifmw.ustring.find(host,"nationalarchives.gov.uk",1,plain)then
ulx.url1.tail="iš"..bracketopen.."UK Government Web Archive"..bracketclose
elseifmw.ustring.find(host,"parliament.uk",1,plain)then
ulx.url1.tail="iš"..bracketopen.."UK Parliament's Web Archive"..bracketclose
elseifmw.ustring.find(host,"nlb.gov.sg",1,plain)then
ulx.url1.tail="iš".."Web Archive Singapore"
elseifmw.ustring.find(host,"pandora.nla.gov.au",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Pandora Archive"..bracketclose
elseifmw.ustring.find(host,"perma.cc",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Perma.cc"..bracketclose
elseifmw.ustring.find(host,"perma-archives.cc",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Perma.cc"..bracketclose
elseifmw.ustring.find(host,"screenshots.com",1,plain)then
ulx.url1.tail="iš Screenshots"
elseifmw.ustring.find(host,"wikiwix.com",1,plain)then
ulx.url1.tail="iš Wikiwix"
elseifmw.ustring.find(host,"freezepage.com",1,plain)then
ulx.url1.tail="iš Freezepage"
elseifmw.ustring.find(host,"webcache.googleusercontent.com",1,plain)then
ulx.url1.tail="iš Google Cache"
elseifmw.ustring.find(host,"timetravel.mementoweb.org",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Memento Project"..bracketclose
elseifmw.ustring.find(host,"webarchive.nla.gov.au",1,plain)then
ulx.url1.tail="iš"..bracketopen.."Australian Web Archive"..bracketclose.."projekto"
else
tracking="Kategorija:Webarchive šablono nenustatytos nuorodos"
end

track[tracking]=1

end

--[[--------------------------< parseExtraArgs >-----------------------

Parse numbered arguments starting at 2, such as url2..url10, date2..date10, title2..title10
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.url = <argument value for url4>
urlx.url3.url = <argument value for url7>
Returns the number of URL arguments found numbered 2 or greater (in this case returns "2" )

]]

localfunctionparseExtraArgs()

locali,j,argurl,argurl2,argdate,argtitle

j=2
fori=2,maxurlsdo
argurl="url"..i
iftrimArg(args[argurl])then
argurl2="url"..j
ulx[argurl2]={}
ulx[argurl2]["url"]=args[argurl]
argdate="date"..j
iftrimArg(args[argdate])then
ulx[argurl2]["date"]=args[argdate]
else
ulx[argurl2]["date"]=inlineRed("[Date missing]","warning")
end
argtitle="title"..j
iftrimArg(args[argtitle])then
ulx[argurl2]["title"]=args[argtitle]
else
ulx[argurl2]["title"]=nil
end
j=j+1
end
end

ifj==2then
return0
else
returnj-2
end

end

--[[--------------------------< comma >-----------------------

Given a date string, return "," if it's MDY

]]

localfunctioncomma(date)
localN=mw.text.split(date,"")
localO=mw.text.split(N[1],"-")-- for ISO
ifO[1]=="index"thenreturn""end
ifnottonumber(O[1])then
return","
else
return""
end
end

--[[--------------------------< createTracking >-----------------------

Return data in track[] ie. tracking categories

]]

localfunctioncreateTracking()

localsand=""
iftableLength(track)>0then
forkey,_inpairs(track)do
sand=sand.."[["..key.."]]"
end
end
returnsand

end

--[[--------------------------< createRendering >-----------------------

Return a rendering of the data in ulx[][]

]]

localfunctioncreateRendering()

localsand,displayheader,displayfield

localperiod1=""-- For backwards compat with {{wayback}}
localperiod2="."

localindexstr="archived"
ifulx.url1.date=="index"then
indexstr="archive"
end
-- For {{wayback}}, {{webcite}}

ifulx.url1.format=="none"then
ifnotulx.url1.titleandnotulx.url1.datethen-- No title. No date
sand="["..ulx.url1.url.."Archyvuota kopija]"..ulx.url1.tail
elseifnotulx.url1.titleandulx.url1.datethen-- No title. Date.
ifulx.url1.service=="wayback"then
period1="."
period2=""
end
sand="["..ulx.url1.url.."Archyvuota kopija]"..ulx.url1.date..comma(ulx.url1.date)..ulx.url1.tail..period1
elseifulx.url1.titleandnotulx.url1.datethen-- Title. No date.
sand="["..ulx.url1.url..""..ulx.url1.title.."]"..ulx.url1.tail
elseifulx.url1.titleandulx.url1.datethen-- Title. Date.
sand="["..ulx.url1.url..""..ulx.url1.title.."]"..ulx.url1.tail.."&#32;("..indexstr..""..ulx.url1.date..")"
else
returnnil
end
ifulx.url1.extraurls>0then-- For multiple archive URLs
localtot=ulx.url1.extraurls+1
sand=sand..period2.."Additional archives:"
fori=2,totdo
localindx="url"..i
ifulx[indx]["title"]then
displayfield="title"
else
displayfield="date"
end
sand=sand.."["..ulx[indx]["url"]..""..ulx[indx][displayfield].."]"
ifi==totthen
sand=sand.."."
else
sand=sand..","
end
end
else
returnsand
end
returnsand
-- For {{cite archives}}

else
ifulx.url1.format=="addlarchives"then-- Multiple archive services
displayheader="Additional archives:"
else-- Multiple pages from the same archive
displayheader="Additional pages archived&nbsp;on"..ulx.url1.date..":"
end
localtot=1+ulx.url1.extraurls
localsand=displayheader
fori=1,totdo
localindx="url"..i
displayfield=ulx[indx]["title"]
ifulx.url1.format=="addlarchives"then
ifnotdisplayfieldthen
displayfield=ulx[indx]["date"]
end
else
ifnotdisplayfieldthen
displayfield="Page"..i
end
end
sand=sand.."["..ulx[indx]["url"]..""..displayfield.."]"
ifi==totthen
sand=sand.."."
else
sand=sand..","
end
end
returnsand
end
end

functionp.webarchive(frame)
args=frame.args
if(args[1]==nil)and(args["url"]==nil)then-- if no argument provided than check parent template/module args
args=frame:getParent().args
end

localtname="Webarchive"-- name of calling template. Change if template rename.
ulx={}-- Associative array to hold template data
track={}-- Associative array to hold tracking categories
maxurls=10-- Max number of URLs allowed.
localverifydates="yes"-- See documentation. Set "no" to disable.

-- URL argument (first)

localurl1=trimArg(args.url)ortrimArg(args.url1)
ifnoturl1then
returninlineError("url","Empty.")..createTracking()
end
ifmw.ustring.find(url1,"https://web.http",1,plain)then-- track bug
track["Category:Webarchive template errors"]=1
returninlineError("url","https://web.http")..createTracking()
end
ifurl1=="https://web.archive.org/http:/"then-- track bug
track["Category:Webarchive template errors"]=1
returninlineError("url","Invalid URL")..createTracking()
end

ulx.url1={}
ulx.url1.url=url1
localuri1=mw.uri.new(ulx.url1.url)
ulx.url1.host=uri1.host
ulx.url1.extraurls=parseExtraArgs()

-- Nolink argument

localnolink=trimArg2(args.nolink)

serviceName(uri1.host,nolink)

-- Date argument

localdate=trimArg(args.date)ortrimArg(args.date1)
ifdate=="*"andulx.url1.service=="wayback"then
date="index"
elseifdateandulx.url1.service=="wayback"andverifydates=="yes"then
localldf=dateFormat(date)
ifldfthen
localudate=decodeWaybackDate(uri1.path,ldf)
ifudate~=datethen
date=udate..inlineRed("<sup>[Date mismatch]</sup>","warning")
end
end
elseifdateandulx.url1.service=="webcite"andverifydates=="yes"then
localldf=dateFormat(date)
ifldfthen
localudate=decodeWebciteDate(uri1.path,ldf)
ifudate=="query"then-- skip
elseifudate~=datethen
date=udate..inlineRed("<sup>[Date mismatch]</sup>","warning")
end
end
elseifdateandulx.url1.service=="archiveis"andverifydates=="yes"then
localldf=dateFormat(date)
ifldfthen
localudate=decodeArchiveisDate(uri1.path,ldf)
ifudate=="short link"then-- skip
elseifudate~=datethen
date=udate..inlineRed("<sup>[Date mismatch]</sup>","warning")
end
end
elseifnotdateandulx.url1.service=="wayback"then
date=decodeWaybackDate(uri1.path,"iso")
ifnotdatethen
date=inlineRed("[Date error] (1)","error")
end
elseifnotdateandulx.url1.service=="webcite"then
date=decodeWebciteDate(uri1.path,"iso")
ifdate=="query"then
date=inlineRed("[Date missing]","warning")
elseifnotdatethen
date=inlineRed("[Date error] (1)","error")
end
elseifnotdateandulx.url1.service=="archiveis"then
date=decodeArchiveisDate(uri1.path,"iso")
ifdate=="short link"then
date=inlineRed("[Date missing]","warning")
elseifnotdatethen
date=inlineRed("[Date error] (1)","error")
end
elseifnotdatethen
date=inlineRed("[Date missing]","warning")
end
ulx.url1.date=date

-- Format argument

localformat=trimArg(args.format)
ifnotformatthen
format="none"
else
ifformat=="addlpages"then
ifnotulx.url1.datethen
format="none"
end
elseifformat=="addlarchives"then
format="addlarchives"
else
format="none"
end
end
ulx.url1.format=format

-- Title argument

localtitle=trimArg(args.title)ortrimArg(args.title1)
ulx.url1.title=title


localrend=createRendering()
ifnotrendthen
rend='<span style= "font-size:100%" class= "error citation-comment" >Error in [[:Template:'..tname..']]: Unknown problem. Please report on template talk page.</span>'
track["Category:Webarchive template errors"]=1
end

returnrend..createTracking()

end

returnp