Jump to content

Module:Citation/CS1: Difference between revisions

sync with sandbox. Address lastauthoramp, postscript, and separator issues
m>Dragons flight
(sync fix to LaySummary)
m>Dragons flight
(sync with sandbox. Address lastauthoramp, postscript, and separator issues)
Line 265: Line 265:
     local format = control.format
     local format = control.format
     local maximum = control.maximum
     local maximum = control.maximum
    local lastauthoramp = control.lastauthoramp;
     local text = {}
     local text = {}
     local etal = false;
     local etal = false;
Line 294: Line 295:
     end
     end
     local count = #text;
     local count = #text;
    if count > 1 and lastauthoramp ~= nil and lastauthoramp ~= "" and not etal then
        text[count-1] = text[count-1] .. " & " .. text[count];
        text[count] = nil;
    end   
     local result = table.concat(text, sep) -- construct list
     local result = table.concat(text, sep) -- construct list
     if etal then  
     if etal then  
Line 494: Line 499:
     local ZBL = args.zbl or args.ZBL
     local ZBL = args.zbl or args.ZBL
     local Quote = args.quote or args.quotation
     local Quote = args.quote or args.quotation
     local PostScript = args.postscript
     local PostScript = args.postscript or "."
     local LaySummary = args.laysummary
     local LaySummary = args.laysummary
     local LaySource = args.laysource
     local LaySource = args.laysource
Line 500: Line 505:
     local TranscriptURL = args["transcript-url"] or args.transcripturl
     local TranscriptURL = args["transcript-url"] or args.transcripturl
     local sepc = args.separator or "."
     local sepc = args.separator or "."
    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 args.notracking or args["no-tracking"] or "";


Line 636: Line 642:
     -- 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 AuthorNameSep = args["author-name-separator"] or args["name-separator"] or ","
         local AuthorNameSep = args["author-name-separator"] or args["name-separator"] or ","
         AuthorNameSep = AuthorNameSep .. " "
         AuthorNameSep = AuthorNameSep .. " "
         local AuthorSep = args["author-separator"] or args["separator"] or "&#59;"
         local AuthorSep = args["author-separator"] or ";"
         AuthorSep = AuthorSep .. " "
         AuthorSep = AuthorSep .. " "
         local AuthorFormat = args["author-format"] or args.authorformat
         local AuthorFormat = args["author-format"] or args.authorformat
         local AuthorMaximum = tonumber(args["display-authors"] or args.displayauthors) or 8
         local AuthorMaximum = tonumber(args["display-authors"] or args.displayauthors) or 8
         local control = { sep = AuthorSep, namesep = AuthorNameSep, format = AuthorFormat, maximum = AuthorMaximum }
         local control = { sep = AuthorSep, namesep = AuthorNameSep, format = AuthorFormat, maximum = AuthorMaximum, lastauthoramp = LastAuthorAmp }
         Authors = listpeople(control, a)  
         Authors = listpeople(control, a)  
     end
     end
     local EditorCount
     local EditorCount
     if ( Editors == nil ) then  
     if ( Editors == nil ) then  
         local EditorNameSep = args["editor-name-separator"] or args["name-separator"] or ", "
         local EditorNameSep = args["editor-name-separator"] or args["name-separator"] or ","
         local EditorSep = args["editor-separator"] or args["separator"] or "&#59; "
        EditorNameSep = EditorNameSep .. " "
         local EditorSep = args["editor-separator"] or ";"
        EditorSep = EditorSep .. " "
         local EditorFormat = args["editor-format"] or args.editorformat
         local EditorFormat = args["editor-format"] or args.editorformat
         local EditorMaximum = tonumber(args["display-editors"] or args.displayeditors) or 3
         local EditorMaximum = tonumber(args["display-editors"] or args.displayeditors) or 3
         local control = { sep = EditorSep, namesep = EditorNameSep, format = EditorFormat, maximum = EditorMaximum }
         local control = { sep = EditorSep, namesep = EditorNameSep, format = EditorFormat, maximum = EditorMaximum, lastauthoramp = LastAuthorAmp }
         Editors, EditorCount = listpeople(control, e)  
         Editors, EditorCount = listpeople(control, e)  
     else
     else
Line 1,021: Line 1,029:
         tcommon = safejoin( {Title, TitleNote, Series, Format, TitleType, Conference, Periodical, Language, Volume, Issue, Others, Edition, Publisher, Agency, Position}, sepc );
         tcommon = safejoin( {Title, TitleNote, Series, Format, TitleType, Conference, Periodical, 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, PostScript }, 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 enddot = "."
    if (Quote ~= "") then enddot = "" end
    if (args.postscript == "") then enddot = "" end
    if ( config.CitationClass == "citation") then enddot = "" end
    idcommon = safejoin( { idcommon, enddot }, sepc )
 
    if ( config.CitationClass == "encyclopaedia" ) then
        Chapter = Chapter
    end


     local text
     local text
Line 1,095: Line 1,094:
     end
     end
      
      
    if ( config.CitationClass == "citation") then PostScript = "" end
    if PostScript ~= '' and PostScript ~= nil and PostScript ~= sepc then
        text = safejoin( {text, sepc}, sepc );  --Deals with italics, spaces, etc.
        text = text:sub(1,-2); --Remove final seperator   
    end   
   
    text = safejoin( {text, PostScript}, sepc );
     -- Now enclose the whole thing in a <span/> element
     -- Now enclose the whole thing in a <span/> element
     if ( Year == nil ) then
     if ( Year == nil ) then
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.