Jump to content

Module:Citation/CS1: Difference between revisions

sync with sandbox. Mostly prep work for dealing with {citation} (e.g. Place=), also code formatting, and wikilinks in urls
m>Dragons flight
(sync to sandbox, addresses handling of trans-title with no title. Also fixes to COinS for encyclopedia mode.)
m>Dragons flight
(sync with sandbox. Mostly prep work for dealing with {citation} (e.g. Place=), also code formatting, and wikilinks in urls)
Line 1: Line 1:
local z = {
local z = {
     error_categories = {};
     error_categories = {};
    message_tail = {};
}
}


Line 81: Line 82:
     end
     end
      
      
     return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" .. args.prefix .. url_string .. args.suffix .. " " .. nowiki(args.id) .. "]"
     return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" ..  
            args.prefix .. url_string .. args.suffix .. " " .. nowiki(args.id) .. "]"
end
end


Line 88: Line 90:
     local sep = args.separator or " "
     local sep = args.separator or " "
     args.suffix = args.suffix or ""
     args.suffix = args.suffix or ""
     return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[[" .. args.prefix .. args.id .. args.suffix .. "|" .. nowiki(args.id) .. "]]"
     return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[[" ..  
            args.prefix .. args.id .. args.suffix .. "|" .. nowiki(args.id) .. "]]"
end
end


Line 98: Line 101:
         domain = "co." .. domain
         domain = "co." .. domain
     end
     end
     return externallinkid({link="Amazon Standard Identification Number",label="ASIN",prefix="//www.amazon."..domain.."/dp/",id=id,encode=false})
     return externallinkid({link="Amazon Standard Identification Number",
        label="ASIN",prefix="//www.amazon."..domain.."/dp/",id=id,encode=false})
end
end


Line 111: Line 115:
         inactive = " (inactive " .. inactive .. ")"  
         inactive = " (inactive " .. inactive .. ")"  
     else  
     else  
         text = externallinkid({link="Digital object identifier",label="doi",prefix="http://dx.doi.org/",id=id,separator=":"})
         text = externallinkid({link="Digital object identifier",label="doi",
            prefix="http://dx.doi.org/",id=id,separator=":"})
         inactive = ""  
         inactive = ""  
     end
     end
Line 123: Line 128:
-- Escape sequences for content that will be used for URL descriptions
-- Escape sequences for content that will be used for URL descriptions
function safeforurl( str )
function safeforurl( str )
    if str:match( "%[%[.-%]%]" ) ~= nil then
        table.insert( z.error_categories, "Pages with citations having wikilinks embedded in URL titles" );
        table.insert( z.message_tail, "Wikilink embedded in URL title" );
    end
   
     return str:gsub( '[%[%]\n]', {     
     return str:gsub( '[%[%]\n]', {     
         ['['] = '[',
         ['['] = '[',
Line 240: Line 250:
     local code = id:sub(-1,-1)
     local code = id:sub(-1,-1)
     if ( code == "A" ) then
     if ( code == "A" ) then
         return externallinkid({link="Open Library",label="OL",prefix="http://openlibrary.org/authors/OL",id=id})
         return externallinkid({link="Open Library",label="OL",
            prefix="http://openlibrary.org/authors/OL",id=id})
     elseif ( code == "M" ) then
     elseif ( code == "M" ) then
         return externallinkid({link="Open Library",label="OL",prefix="http://openlibrary.org/books/OL",id=id})
         return externallinkid({link="Open Library",label="OL",
            prefix="http://openlibrary.org/books/OL",id=id})
     elseif ( code == "W" ) then
     elseif ( code == "W" ) then
         return externallinkid({link="Open Library",label="OL",prefix= "http://openlibrary.org/works/OL",id=id})
         return externallinkid({link="Open Library",label="OL",
            prefix= "http://openlibrary.org/works/OL",id=id})
     else
     else
         table.insert( z.error_categories, "Pages with OL errors" );
         table.insert( z.error_categories, "Pages with OL errors" );
         return externallinkid({link="Open Library",label="OL",prefix= "http://openlibrary.org/OL",id=id}) ..  
         return externallinkid({link="Open Library",label="OL",
            prefix= "http://openlibrary.org/OL",id=id}) ..  
             ' <span class="error">Bad OL specified</span>';
             ' <span class="error">Bad OL specified</span>';
     end
     end
Line 309: Line 323:
     end
     end
      
      
     if ( "scap" == format ) then result= createTag({name="span", contents=result, params={class="smallcaps", style="font-variant:small-caps;"}}) end -- if necessary wrap result in <span> tag to format in Small Caps
    -- if necessary wrap result in <span> tag to format in Small Caps
     if ( "scap" == format ) then result= createTag({name="span", contents=result,  
        params={class="smallcaps", style="font-variant:small-caps;"}}) end  
     return result, count
     return result, count
end
end
Line 337: Line 353:
      
      
     while true do
     while true do
         last = args["author" .. i .. "-last"] or args["author-last" .. i] or args["last" .. i] or args["surname" .. i] or args["Author" .. i] or args["author" .. i]
         last = args["author" .. i .. "-last"] or args["author-last" .. i] or  
                args["last" .. i] or args["surname" .. i] or args["Author" .. i] or args["author" .. i]
         if ( last and "" < last ) then -- just in case someone passed in an empty parameter
         if ( last and "" < last ) then -- just in case someone passed in an empty parameter
             authors[i] = {
             authors[i] = {
                 last = last,
                 last = last,
                 first = args["author" .. i .. "-first"] or args["author-first" .. i] or args["first" .. i] or args["given" .. i],
                 first = args["author" .. i .. "-first"] or args["author-first" .. i] or  
                 link = args["author" .. i .. "-link"] or args["author-link" .. i] or args["author" .. i .. "link"] or args["authorlink" .. i],
                        args["first" .. i] or args["given" .. i],
                 mask = args["author" .. i .. "-mask"] or args["author-mask" .. i] or args["author" .. i .. "mask"] or args["authormask" .. i]
                 link = args["author" .. i .. "-link"] or args["author-link" .. i] or  
                        args["author" .. i .. "link"] or args["authorlink" .. i],
                 mask = args["author" .. i .. "-mask"] or args["author-mask" .. i] or  
                        args["author" .. i .. "mask"] or args["authormask" .. i]
             }
             }
         else
         else
Line 360: Line 380:
      
      
     while true do
     while true do
         last = args["editor" .. i .. "-last"] or args["editor-last" .. i] or args["EditorSurname" .. i] or args["Editor" .. i] or args["editor" .. i]
         last = args["editor" .. i .. "-last"] or args["editor-last" .. i] or  
                args["EditorSurname" .. i] or args["Editor" .. i] or args["editor" .. i]
         if ( last and "" < last ) then -- just in case someone passed in an empty parameter
         if ( last and "" < last ) then -- just in case someone passed in an empty parameter
             editors[i] = {
             editors[i] = {
                 last = last,
                 last = last,
                 first = args["editor" .. i .. "-first"] or args["editor-first" .. i] or args["EditorGiven" .. i],
                 first = args["editor" .. i .. "-first"] or args["editor-first" .. i] or args["EditorGiven" .. i],
                 link = args["editor" .. i .. "-link"] or args["editor-link" .. i] or args["editor" .. i .. "link"] or args["editorlink" .. i],
                 link = args["editor" .. i .. "-link"] or args["editor-link" .. i] or  
                 mask = args["editor" .. i .. "-mask"] or args["editor-mask" .. i] or args["editor" .. i .. "mask"] or args["editormask" .. i]
                        args["editor" .. i .. "link"] or args["editorlink" .. i],
                 mask = args["editor" .. i .. "-mask"] or args["editor-mask" .. i] or  
                        args["editor" .. i .. "mask"] or args["editormask" .. i]
             }
             }
         else
         else
Line 402: Line 425:
     args["editor1link"] = args["editor1link"] or args["editorlink"]     
     args["editor1link"] = args["editor1link"] or args["editorlink"]     


     -- Pick out the relevant fields from the arguments.  Different citation templates define different field names for the same underlying things.     
     -- Pick out the relevant fields from the arguments.  Different citation templates
    -- define different field names for the same underlying things.     
     local Authors = args.authors
     local Authors = args.authors
     local i  
     local i  
Line 434: Line 458:
     local ChapterURL = args["chapter-url"] or args.chapterurl
     local ChapterURL = args["chapter-url"] or args.chapterurl
     local ConferenceURL = args["conference-url"] or args.conferenceurl
     local ConferenceURL = args["conference-url"] or args.conferenceurl
     local Periodical = args.journal or args.newspaper or args.magazine or args.work or args.periodical or args.encyclopedia or args.encyclopaedia
     local Periodical = args.journal or args.newspaper or args.magazine or args.work
            or args.periodical or args.encyclopedia or args.encyclopaedia
           
     if ( config.CitationClass == "encyclopaedia" ) then
     if ( config.CitationClass == "encyclopaedia" ) then
         if ( args.article and args.article ~= "") then
         if ( args.article and args.article ~= "") then
Line 477: Line 503:
      
      
     local Edition = args.edition
     local Edition = args.edition
     local PublicationPlace = args["publication-place"] or args.publicationplace or args.place or args.location
     local PublicationPlace = args["publication-place"] or args.publicationplace  
            or args.place or args.location
    local Place = args.place or args.location
    if PublicationPlace == Place then Place = nil; end
   
     local Location = PublicationPlace
     local Location = PublicationPlace
     local PublisherName = args.publisher
     local PublisherName = args.publisher
Line 518: Line 548:
     local sepc = args.separator or "."
     local sepc = args.separator or "."
     local LastAuthorAmp = args.lastauthoramp
     local LastAuthorAmp = args.lastauthoramp
     local no_tracking_cats = args["template doc demo"] or args.nocat or args.notracking or args["no-tracking"] or "";
     local no_tracking_cats = args["template doc demo"] or args.nocat or  
    local MessageTail = {};
            args.notracking or args["no-tracking"] or "";


     if ( config.CitationClass == "journal" ) then
     if ( config.CitationClass == "journal" ) then
Line 528: Line 558:
           end
           end
         end
         end
    elseif ( config.CitationClass == "citation" ) then
        sepc = ","
        if ( Ref == nil ) then Ref = "harv" end
     end
     end


Line 571: Line 598:
     end
     end
      
      
     -- These data form a COinS tag (see <http://ocoins.info/>) which allows automated tools to parse the citation information.
     -- These data form a COinS tag (see <http://ocoins.info/>) which allows  
    -- automated tools to parse the citation information.
     local OCinSdata = {} -- COinS metadata excluding id, bibcode, doi, etc.
     local OCinSdata = {} -- COinS metadata excluding id, bibcode, doi, etc.
     local ctx_ver = "Z39.88-2004"  
     local ctx_ver = "Z39.88-2004"  
Line 653: Line 681:


     -- Now perform various field substitutions.
     -- Now perform various field substitutions.
     -- We also add leading spaces and surrounding markup and punctuation to the various parts of the citation, but only when they are non-nil.
     -- We also add leading spaces and surrounding markup and punctuation to the
    -- various parts of the citation, but only when they are non-nil.
     if ( Authors == nil ) then  
     if ( Authors == nil ) then  
         local Maximum = tonumber(args["display-authors"] or args.displayauthors);
         local Maximum = tonumber(args["display-authors"] or args.displayauthors);
Line 661: Line 690:
             Maximum = 8;
             Maximum = 8;
             table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
             table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
             table.insert( MessageTail, 'Citation uses old-style implicit et al. for authors' );
             table.insert( z.message_tail, 'Citation uses old-style implicit et al. for authors' );
         elseif Maximum == nil then
         elseif Maximum == nil then
             Maximum = #a + 1;
             Maximum = #a + 1;
Line 690: Line 719:
             Maximum = 3;
             Maximum = 3;
             table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
             table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
             table.insert( MessageTail, 'Citation uses old-style implicit et al. for editors' );
             table.insert( z.message_tail, 'Citation uses old-style implicit et al. for editors' );
         elseif Maximum == nil then
         elseif Maximum == nil then
             Maximum = #e + 1;
             Maximum = #e + 1;
Line 756: Line 785:
         if ( config.CitationClass == "web" ) then
         if ( config.CitationClass == "web" ) then
             table.insert( z.error_categories, 'Pages using web citations with no URL' );
             table.insert( z.error_categories, 'Pages using web citations with no URL' );
             table.insert( MessageTail, 'No URL on cite web' );
             table.insert( z.message_tail, 'No URL on cite web' );
         end
         end


Line 762: Line 791:
         if ( AccessDate ~= nil and AccessDate ~= '' ) then
         if ( AccessDate ~= nil and AccessDate ~= '' ) then
             table.insert( z.error_categories, 'Pages using citations with accessdate and no URL' );
             table.insert( z.error_categories, 'Pages using citations with accessdate and no URL' );
             table.insert( MessageTail, 'Accessdate used without URL' );
             table.insert( z.message_tail, 'Accessdate used without URL' );
             AccessDate = nil;
             AccessDate = nil;
         end       
         end       
Line 781: Line 810:
             ( TransChapter == nil or TransChapter == "" ) then
             ( TransChapter == nil or TransChapter == "" ) then
         table.insert( z.error_categories, 'Pages with citations lacking titles' );
         table.insert( z.error_categories, 'Pages with citations lacking titles' );
         table.insert( MessageTail, 'Citation has no title' );
         table.insert( z.message_tail, 'Citation has no title' );
     end
     end


Line 835: Line 864:
             Title = "\"" .. Title .. "\""
             Title = "\"" .. Title .. "\""
         elseif ( config.CitationClass == "web"
         elseif ( config.CitationClass == "web"
                 or config.CitationClass == "news" ) and  
                 or config.CitationClass == "news"
                or config.CitationClass == "pressrelease" ) and  
                 Chapter == "" then
                 Chapter == "" then
             Title = "\"" .. Title .. "\""
             Title = "\"" .. Title .. "\""
Line 857: Line 887:
     end
     end


 
    if ( Place ~= nil and Place ~= "" ) then
        if sepc == '.' then
            Place = " Written at " .. Place .. sepc .. " ";
        else
            Place = " written at " .. Place .. sepc .. " ";
        end           
    else
        Place = "";
    end
   
     if ( Conference ~= nil and Conference ~="" ) then
     if ( Conference ~= nil and Conference ~="" ) then
         if ( ConferenceURL ~= nil ) then
         if ( ConferenceURL ~= nil ) then
Line 954: Line 993:
     if ( SubscriptionRequired ~= nil and
     if ( SubscriptionRequired ~= nil and
         SubscriptionRequired ~= "" ) then
         SubscriptionRequired ~= "" ) then
         SubscriptionRequired = sepc .. " " .. createTag({name="span", contents="(subscription required)", params={style="font-size:0.95em; font-size: 90%; color: #555"}})
         SubscriptionRequired = sepc .. " " .. createTag({name="span", contents="(subscription required)",  
            params={style="font-size:0.95em; font-size: 90%; color: #555"}})
     else
     else
         SubscriptionRequired = ""
         SubscriptionRequired = ""
     end
     end
     if ( ARXIV ~= nil and ARXIV ~= "" ) then
     if ( ARXIV ~= nil and ARXIV ~= "" ) then
         ARXIV = sepc .. " " .. externallinkid({label="arXiv",link="arXiv",prefix="http://arxiv.org/abs/",id=ARXIV,separator=":",encode=false}) else ARXIV = "" end
         ARXIV = sepc .. " " .. externallinkid({label="arXiv",link="arXiv",
            prefix="http://arxiv.org/abs/",id=ARXIV,separator=":",encode=false}) else ARXIV = "" end
     if ( ASIN ~= nil and ASIN ~= "" ) then  
     if ( ASIN ~= nil and ASIN ~= "" ) then  
         ASIN = sepc .. " " .. amazon(ASIN, ASINTLD) else ASIN = "" end
         ASIN = sepc .. " " .. amazon(ASIN, ASINTLD) else ASIN = "" end
     if ( BIBCODE ~= nil and BIBCODE ~= "" ) then
     if ( BIBCODE ~= nil and BIBCODE ~= "" ) then
         BIBCODE = sepc .. " " .. externallinkid({label="Bibcode",link="Bibcode",prefix="http://adsabs.harvard.edu/abs/",id=BIBCODE,separator=":"}) else BIBCODE = "" end
         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
     if ( DOI ~= nil and DOI ~= "" ) then
         DOI = sepc .. " " .. doi(DOI, DoiBroken) else DOI = "" end
         DOI = sepc .. " " .. doi(DOI, DoiBroken) else DOI = "" end
     if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
     if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
     if ( ISBN ~= nil and ISBN ~= "") then
     if ( ISBN ~= nil and ISBN ~= "") then
         ISBN = sepc .. " " .. internallinkid({label="ISBN",link="International Standard Book Number",prefix="Special:BookSources/",id=ISBN}) else ISBN = "" end
         ISBN = sepc .. " " .. internallinkid({label="ISBN",link="International Standard Book Number",
            prefix="Special:BookSources/",id=ISBN}) else ISBN = "" end
     if ( ISSN ~= nil and ISSN ~="" ) then
     if ( ISSN ~= nil and ISSN ~="" ) then
         ISSN = sepc .. " " .. externallinkid({label="ISSN",link="International Standard Serial Number",prefix="//www.worldcat.org/issn/",id=ISSN,encode=false}) else ISSN = "" end
         ISSN = sepc .. " " .. externallinkid({label="ISSN",link="International Standard Serial Number",
            prefix="//www.worldcat.org/issn/",id=ISSN,encode=false}) else ISSN = "" end
     if ( JFM ~= nil and JFM ~="" ) then
     if ( JFM ~= nil and JFM ~="" ) then
         JFM = sepc .." " .. externallinkid({label="JFM",link="Jahrbuch über die Fortschritte der Mathematik",prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=JFM}) else JFM = "" end
         JFM = sepc .." " .. externallinkid({label="JFM",link="Jahrbuch über die Fortschritte der Mathematik",
            prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=JFM}) else JFM = "" end
     if ( JSTOR ~= nil and JSTOR ~="") then
     if ( JSTOR ~= nil and JSTOR ~="") then
         JSTOR = sepc .." " .. externallinkid({label="JSTOR",link="JSTOR",prefix="http://www.jstor.org/stable/",id=JSTOR}) else JSTOR = "" end
         JSTOR = sepc .." " .. externallinkid({label="JSTOR",link="JSTOR",
            prefix="http://www.jstor.org/stable/",id=JSTOR}) else JSTOR = "" end
     if ( LCCN ~= nil and LCCN ~="" ) then
     if ( LCCN ~= nil and LCCN ~="" ) then
         LCCN = sepc .." " .. externallinkid({label="LCCN",link="Library of Congress Control Number",prefix="http://lccn.loc.gov/",id=LCCN,encode=false}) else LCCN = "" end
         LCCN = sepc .." " .. externallinkid({label="LCCN",link="Library of Congress Control Number",
            prefix="http://lccn.loc.gov/",id=LCCN,encode=false}) else LCCN = "" end
     if ( MR ~= nil and MR ~="" ) then
     if ( MR ~= nil and MR ~="" ) then
         MR = sepc .." " .. externallinkid({label="MR",link="Mathematical Reviews",prefix="http://www.ams.org/mathscinet-getitem?mr=",id=MR}) else MR = "" end
         MR = sepc .." " .. externallinkid({label="MR",link="Mathematical Reviews",
            prefix="http://www.ams.org/mathscinet-getitem?mr=",id=MR}) else MR = "" end
     if ( OCLC ~= nil and OCLC ~="") then  
     if ( OCLC ~= nil and OCLC ~="") then  
         OCLC = sepc .." " .. externallinkid({label="OCLC",link="OCLC",prefix="//www.worldcat.org/oclc/",id=OCLC}) else OCLC = "" end
         OCLC = sepc .." " .. externallinkid({label="OCLC",link="OCLC",
            prefix="//www.worldcat.org/oclc/",id=OCLC}) else OCLC = "" end
     if ( OL ~= nil and OL ~="") then
     if ( OL ~= nil and OL ~="") then
         OL = sepc .. " " .. openlibrary(OL) else OL = "" end     
         OL = sepc .. " " .. openlibrary(OL) else OL = "" end     
     if ( OSTI ~= nil and OSTI ~="") then
     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
         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
     if ( PMC ~= nil and PMC ~="") then
     if ( PMC ~= nil and PMC ~="") then
         PMC = sepc .." " .. externallinkid({label="PMC",link="PubMed Central",prefix="//www.ncbi.nlm.nih.gov/pmc/articles/PMC",suffix=" ",id=PMC}) else PMC = "" end
         PMC = sepc .." " .. externallinkid({label="PMC",link="PubMed Central"
            ,prefix="//www.ncbi.nlm.nih.gov/pmc/articles/PMC",suffix=" ",id=PMC}) else PMC = "" end
     if ( PMID ~= nil and PMID ~="") then
     if ( PMID ~= nil and PMID ~="") then
         PMID = sepc .." " .. externallinkid({label="PMID",link="PubMed Identifier",prefix="//www.ncbi.nlm.nih.gov/pubmed/",id=PMID,encode=false}) else PMID = "" end
         PMID = sepc .." " .. externallinkid({label="PMID",link="PubMed Identifier",
            prefix="//www.ncbi.nlm.nih.gov/pubmed/",id=PMID,encode=false}) else PMID = "" end
     if ( RFC ~= nil and RFC ~="") then
     if ( RFC ~= nil and RFC ~="") then
         RFC = sepc .." " .. externallinkid({label="RFC",link="Request for Comments",prefix="//tools.ietf.org/html/rfc",id=RFC,encode=false}) else RFC = "" end
         RFC = sepc .." " .. externallinkid({label="RFC",link="Request for Comments",
            prefix="//tools.ietf.org/html/rfc",id=RFC,encode=false}) else RFC = "" end
     if ( SSRN ~= nil and SSRN ~="") then
     if ( SSRN ~= nil and SSRN ~="") then
         SSRN = sepc .." " .. externallinkid({label="SSRN",link="Social Science Research Network",prefix="http://ssrn.com/abstract=",id=SSRN}) else SSRN = "" end
         SSRN = sepc .." " .. externallinkid({label="SSRN",link="Social Science Research Network",
            prefix="http://ssrn.com/abstract=",id=SSRN}) else SSRN = "" end
     if ( ZBL ~= nil and ZBL ~="") then
     if ( ZBL ~= nil and ZBL ~="") then
         ZBL = sepc .." " .. externallinkid({label="Zbl",link="Zentralblatt MATH",prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=ZBL}) else ZBL = "" end
         ZBL = sepc .." " .. externallinkid({label="Zbl",link="Zentralblatt MATH",
            prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=ZBL}) else ZBL = "" end


     if ( URL ~= nil and URL ~="") then
     if ( URL ~= nil and URL ~="") then
Line 1,026: Line 1,081:
             ArchiveDate = " " .. ArchiveDate
             ArchiveDate = " " .. ArchiveDate
         else  
         else  
             ArchiveDate = " <span class='error'>If you specify <code>archiveurl=</code>, you must also specify <code>archivedate=</code></span> "
             ArchiveDate = " <span class='error'>If you specify <code>archiveurl=</code>, " ..
                "you must also specify <code>archivedate=</code></span> "
             table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
             table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
         end
         end
Line 1,062: Line 1,118:
             LaySource = ""  
             LaySource = ""  
         end
         end
         Lay = sepc .. " [" .. LaySummary .. " Lay summary]" .. LaySource .. LayDate
         if sepc == '.' then
            Lay = sepc .. " [" .. LaySummary .. " Lay summary]" .. LaySource .. LayDate
        else
            Lay = sepc .. " [" .. LaySummary .. " lay summary]" .. LaySource .. LayDate
        end           
     else
     else
         Lay = ""
         Lay = ""
Line 1,109: Line 1,169:


     local tcommon
     local tcommon
     if ( config.CitationClass == "journal" and
     if ( ( (config.CitationClass == "journal") or (config.CitationClass == "citation") )  and
         Periodical ~= "" ) then
         Periodical ~= "" ) then
         if (Others ~= "") then Others = Others .. sepc .. " " end
         if (Others ~= "") then Others = Others .. sepc .. " " end
         tcommon = safejoin( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume, Issue, Position}, sepc );
         tcommon = safejoin( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series,  
    elseif ( config.CitationClass == "citation" ) or (config.CitationClass == "encyclopaedia" ) then
            Language, Edition, Publisher, Agency, Volume, Issue, Position}, sepc );
        tcommon = safejoin( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Issue, Edition, Publisher, Agency, Others, Position}, sepc );
     else  
     else  
         tcommon = safejoin( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Issue, Others, Edition, Publisher, Agency, Position}, sepc );
         tcommon = safejoin( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language,  
            Volume, Issue, Others, Edition, Publisher, Agency, Position}, sepc );
     end
     end
      
      
     local idcommon = safejoin( { ARXIV, ASIN, BIBCODE, DOI, ISBN, ISSN, JFM, JSTOR, LCCN, MR, OCLC, OL, OSTI, PMC, PMID, RFC, SSRN, URL, ZBL, ID, Archived, AccessDate, Via, SubscriptionRequired, Lay, Quote }, sepc );
     local idcommon = safejoin( { ARXIV, ASIN, BIBCODE, DOI, ISBN, ISSN, JFM, JSTOR, LCCN, MR, OCLC, OL, OSTI,  
        PMC, PMID, RFC, SSRN, URL, ZBL, ID, Archived, AccessDate, Via, SubscriptionRequired, Lay, Quote }, sepc );


     local text
     local text
Line 1,148: Line 1,209:
             end
             end
         end
         end
         text = safejoin( {Authors, Date, Chapter, Editors, tcommon }, sepc );
         text = safejoin( {Authors, Date, Chapter, Place, Editors, tcommon }, sepc );
         text = safejoin( {text, pgtext, idcommon}, sepc );
         text = safejoin( {text, pgtext, idcommon}, sepc );
     elseif ( "" ~= Editors) then
     elseif ( "" ~= Editors) then
Line 1,165: Line 1,226:
             end
             end
         end
         end
         text = safejoin( {Editors, Date, Chapter, tcommon}, sepc );
         text = safejoin( {Editors, Date, Chapter, Place, tcommon}, sepc );
         text = safejoin( {text, pgtext, idcommon}, sepc );
         text = safejoin( {text, pgtext, idcommon}, sepc );
     else
     else
Line 1,175: Line 1,236:
         end -- endif ""~=Date
         end -- endif ""~=Date
         if ( config.CitationClass=="journal" and Periodical ) then
         if ( config.CitationClass=="journal" and Periodical ) then
           text = safejoin( {Chapter, tcommon}, sepc );
           text = safejoin( {Chapter, Place, tcommon}, sepc );
           text = safejoin( {text, pgtext, Date, idcommon}, sepc );
           text = safejoin( {text, pgtext, Date, idcommon}, sepc );
         else
         else
           text = safejoin( {Chapter, tcommon, Date}, sepc );
           text = safejoin( {Chapter, Place, tcommon, Date}, sepc );
           text = safejoin( {text, pgtext, idcommon}, sepc );
           text = safejoin( {text, pgtext, idcommon}, sepc );
         end
         end
     end
     end
      
      
    if ( config.CitationClass == "citation") then PostScript = "" end
     if PostScript ~= '' and PostScript ~= nil and PostScript ~= sepc then
     if PostScript ~= '' and PostScript ~= nil and PostScript ~= sepc then
         text = safejoin( {text, sepc}, sepc );  --Deals with italics, spaces, etc.
         text = safejoin( {text, sepc}, sepc );  --Deals with italics, spaces, etc.
Line 1,233: Line 1,293:
         z.error_categories = { 'Pages with empty citations' };
         z.error_categories = { 'Pages with empty citations' };
         text = '<span class="error">Citation is empty</span>';
         text = '<span class="error">Citation is empty</span>';
         MessageTail = {};
         z.message_tail = {};
     end
     end
      
      
Line 1,244: Line 1,304:
     text = text .. OCinS;
     text = text .. OCinS;
      
      
     if #MessageTail ~= 0 then
     if #z.message_tail ~= 0 then
         text = text .. hiddencomment( table.concat( MessageTail, "; " ) );
         text = text .. hiddencomment( table.concat( z.message_tail, "; " ) );
     end
     end
      
      
Line 1,273: Line 1,333:
     for k, v in pairs( frame.args ) do
     for k, v in pairs( frame.args ) do
         config[k] = v;
         config[k] = v;
        if args[k] == nil and (v ~= '' or k == 'postscript') then
            args[k] = v;
        end       
     end     
     end     
      
      
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.