Module:Citation/CS1: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
error handling for archiveurl / url |
Adds a variety of error tracking and handling |
||
வரிசை 1:
local z = {}
வரி 21 ⟶ 15:
["'"] = ''',
['['] = '[',
[']'] = ']',
['{'] = '{',
['|'] = '|',
['}'] = '}' } );
வரி 108 ⟶ 102:
end
function doi(id, inactive
local cat = ""
local error_categories = {};
local text;
if ( inactive ~= nil ) then
text = "[[Digital object identifier|doi]]:" .. id;
inactive = " (inactive " .. inactive .. ")"
else
வரி 120 ⟶ 116:
end
if ( string.sub(id,1,3) ~= "10." ) then
cat = ' <span class="error">Bad DOI (expected "10." prefix) in code number</span>'
end
▲ return text .. inactive .. cat
end
வரி 235 ⟶ 231:
function openlibrary(id)
local
local prefix = ""
local code = id:sub(-1,-1)
வரி 246 ⟶ 242:
else
prefix = "http://openlibrary.org/OL"
end
local text = externallinkid({link="Open Library",label="OL",prefix=prefix,id=id})
if #error_categories ~= 0 then
return text .. cat▼
text = text .. ' <span class="error">Bad OL specified</span>';
end
return text, error_categories
end
வரி 360 ⟶ 359:
function citation0( config, args)
local error_categories = {};
--------------------------------------------------- Get parameters
வரிசை 495:
local TranscriptURL = args["transcript-url"] or args.transcripturl
local sepc = args.separator
local no_tracking_cats = args["template doc demo"] or args["nocat"] or args["notracking"] or args["no-tracking"];
if ( config.CitationClass == "journal" ) then
வரி 678 ⟶ 680:
-- Captures the value for Date prior to adding parens or other textual transformations
local DateIn = Date
if ( config.CitationClass == "web" ) then
if ( URL == nil or URL == '' ) and
( ChapterURL == nil or ChapterURL == '' ) and
( ArchiveURL == nil or ArchiveURL == '' ) and
( ConferenceURL == nil or ConferenceURL == '' ) and
( TranscriptURL == nil or TranscriptURL == '' ) then
table.insert( error_categories, 'Pages using web citations with no URL' );
if Title == nil or Title == "" then
Authors = Authors .. "<!-- No URL on cite web here -->";
else
Title = Title .. "<!-- No URL on cite web here -->";
end
end
end
if ( Chapter == nil or Chapter == "" ) and
( Title == nil or Title == "" ) and
( Periodcial == nil or Periodical == "" ) and
( Conference == nil or Conference == "" ) then
table.insert( error_categories, 'Pages with citations lacking titles' );
Authors = Authors .. "<!-- No citation title here -->";
end
if ( Format ~= nil and Format ~="" ) then
வரி 839 ⟶ 863:
BIBCODE = sepc .. " " .. externallinkid({label="Bibcode",link="Bibcode",prefix="http://adsabs.harvard.edu/abs/",id=BIBCODE,separator=":"}) else BIBCODE = "" end
if ( DOI ~= nil and DOI ~= "" ) then
local DOI_string, DOI_error;
DOI = sepc .. " " .. doi(DOI, DoiBroken) else DOI = "" end▼
DOI_string, DOI_error = doi(DOI, DoiBroken);
for _, v in ipairs( DOI_error ) do
table.insert( error_categories, v );
end
else
DOI = ""
end
if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
if ( ISBN ~= nil and ISBN ~= "") then
வரி 856 ⟶ 888:
OCLC = sepc .." " .. externallinkid({label="OCLC",link="OCLC",prefix="//www.worldcat.org/oclc/",id=OCLC}) else OCLC = "" end
if ( OL ~= nil and OL ~="") then
local OL_string, OL_error;
OL = sepc .." " .. openlibrary(OL) else OL = "" end▼
OL_string, OL_error = openlibrary(OL);
for _, v in ipairs( OL_error ) do
table.insert( error_categories, v );
end
else
OL = "";
end
if ( OSTI ~= nil and OSTI ~="") then
OSTI = sepc .." " .. externallinkid({label="OSTI",link="Office of Scientific and Technical Information",prefix="http://www.osti.gov/energycitations/product.biblio.jsp?osti_id=",id=OSTI}) else OSTI = "" end
வரி 869 ⟶ 909:
if ( URL ~= nil and URL ~="") then
URL = " " .. url(URL)
table.insert( error_categories, "Pages with citations having bare URLs" );
if config.CitationClass == "web" then
URL = URL .. " <span class='error'>No <code>title=</code> specified</span>"
else
URL = URL .. "<!-- Bare URL here -->"
end
else
URL = ""
வரி 890 ⟶ 936:
ArchiveDate = " " .. ArchiveDate
else
ArchiveDate = " <span class='error'>If you specify <code>archiveurl=</code>, you must also specify <code>archivedate=</code></span> "
table.insert( error_categories, 'Pages with archiveurl citation errors' );
end
local arch_text = " archived"
வரி 902 ⟶ 949:
Archived = sepc .. arch_text .. " from <span class='error'>If you specify <code>archiveurl=</code>" ..
", you must also specify <code>url=</code></span> on" .. ArchiveDate
table.insert( error_categories, 'Pages with archiveurl citation errors' );
end
end
வரி 963 ⟶ 1,011:
local tcommon
if ( config.CitationClass == "journal" ) then
tcommon = safejoin( {Title, TitleNote, Format, TitleType, Conference, Periodical, Series, Language, Edition, Publisher, Agency, Others, Volume, Issue, Position
elseif ( config.CitationClass == "citation" ) or (config.CitationClass == "encyclopaedia" ) then
tcommon = safejoin( {Title, TitleNote, Format, TitleType, Conference, Periodical, Series, Language, Volume, Issue, Edition, Publisher, Agency, Others, Position}, sepc );
வரி 985 ⟶ 1,033:
local pgtext = Page .. Pages .. At
if page_error then
table.insert( error_categories, 'Pages with citations using conflicting page specifications' );
pgtext = pgtext .. '
end
வரி 1,082 ⟶ 1,131:
end
if string.len(text:gsub("%b<>", "")) <= 2 then
table.insert( error_categories, 'Pages with empty citations' );
text = '<span class="error">Citation is empty</span>';
end
வரி 1,092 ⟶ 1,142:
-- Note: Using display: none on then COinS span breaks some clients.
local OCinS = createTag({name="span", contents=empty_span, params={class="Z3988",title=OCinStitle }})
text = text .. OCinS;
▲ return text .. OCinS
if no_tracking_cats ~= nil and no_tracking_cats ~= '' then
error_categories = {};
end
for _, v in pairs( error_categories ) do
text = text .. '[[Category:' .. v ..']]';
end
end
| |||