Modul:Citation/CS1/peskovnik: Razlika med redakcijama

Izbrisana vsebina Dodana vsebina
mBrez povzetka urejanja
mBrez povzetka urejanja
Vrstica 1.807:
if not url:match('//web%.archive%.org/') then
return url, date; -- not an archive.org archive, return archiveURLArchiveURL and ArchiveDate
end
 
if url:match('//web%.archive%.org/save/') then -- if a save command url, we don't want to allow saving of the target page
table.insert( z.message_tail, { set_error( 'archive_url', {'save command'}, true ) } ); -- add error message
if Preview_mode then
return '', ''; -- return empty strings for archiveURL and ArchiveDate
return url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1), date; -- preview mode: modify and return ArchiveURL and ArchiveDate
else
return '', ''; -- return empty strings for archiveURL and ArchiveDate
-- end
end
 
-- if url:match('//web%.archive%.org/web/%*/') or url:match('//web%.archive%.org/%*/') then -- wildcard with or without 'web/' path element
-- table.insert( z.message_tail, { set_error( 'archive_url', {'wildcard'}, true ) } ); -- add error message and
-- return '', ''; -- return empty strings for archiveURL and ArchiveDate
-- end
path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the url parts for evaluation
 
if not is_set(timestamp) or 14 ~= timestamp:len() then -- path and flag optional, must have 14-digit timestamp here
err_msg = 'timestamp';
if '*' ~= flag then
url=url:gsub ('(//web%.archive%.org/[^%d]*%d?%d?%d?%d?%d?%d?)[^/]*', '%1*', 1) -- for preview, modify ts to be yearmo* max (0-6 digits plus splat)
end
elseif is_set(path) and 'web/' ~= path then -- older archive urls do not have the extra 'web/' path element
err_msg = 'path';
Vrstica 1.835 ⟶ 1.842:
-- if here something not right so
table.insert( z.message_tail, { set_error( 'archive_url', {err_msg}, true ) } ); -- add error message and
if Preview_mode then
return '', ''; -- return empty strings for archiveURL and ArchiveDate
return url, date; -- preview mode so return archiveURL and ArchiveDate
else
return '', ''; -- return empty strings for archiveURL and ArchiveDate
end -- return empty strings for archiveURL and ArchiveDate
end
 
Vrstica 1.980 ⟶ 1.991:
ArchiveURL, ArchiveDate = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])
-- local ArchiveDate = A['ArchiveDate'];
-- local ArchiveURL = A['ArchiveURL'];
-- if ArchiveURL:match('//web%.archive%.org/save/') then -- if an archive.org save command url, we don't want to save target page ...
-- ArchiveURL = ''; -- every time a reader clicks the link so
-- ArchiveDate = ''; -- unset these
-- table.insert( z.message_tail, { set_error( 'archive_save', {}, true ) } ); -- and add error message
-- end
local DeadURL = A['DeadURL']
if not is_valid_parameter_value (DeadURL, 'dead-url', cfg.keywords ['deadurl']) then -- set in config.defaults to 'yes'