Module:Citation/CS1: Difference between revisions

sync to sandbox, addressing hyphen links, authormask, bolding, etc.
m>Dragons flight
(sync with sandbox. Address lastauthoramp, postscript, and separator issues)
m>Dragons flight
(sync to sandbox, addressing hyphen links, authormask, bolding, etc.)
Line 133: Line 133:
     if str == nil then
     if str == nil then
         return nil;
         return nil;
    end   
    if str:match( "[%[%]{}<>]" ) ~= nil then
        return str;
     end     
     end     
     return str:gsub( '-', '–' );
     return str:gsub( '-', '–' );
Line 383: Line 386:
       or args.first or args.first1 or args.given or args.given1
       or args.first or args.first1 or args.given or args.given1
     args["author1-link"] = args["author1-link"] or args["author-link"]
     args["author1-link"] = args["author1-link"] or args["author-link"]
     args["author1-mask"] = args["author1-mask"] or args["author-mask"]
     args["author1-mask"] = args["author1-mask"] or args["author-mask"] or args["authormask"]
     args["author1link"] = args["author1link"] or args["authorlink"]     
     args["author1link"] = args["author1link"] or args["authorlink"]     
     args["editor1"] = args["editor1"] or args["editor"]
     args["editor1"] = args["editor1"] or args["editor"]
Line 389: Line 392:
     args["editor1-first"] = args["editor1-first"] or args["editor-first"]
     args["editor1-first"] = args["editor1-first"] or args["editor-first"]
     args["editor1-link"] = args["editor1-link"] or args["editor-link"]
     args["editor1-link"] = args["editor1-link"] or args["editor-link"]
     args["editor1-mask"] = args["editor1-mask"] or args["editor-mask"]
     args["editor1-mask"] = args["editor1-mask"] or args["editor-mask"] or args["editormask"]
     args["editor1link"] = args["editor1link"] or args["editorlink"]     
     args["editor1link"] = args["editor1link"] or args["editorlink"]     


Line 507: Line 510:
     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 args.notracking or args["no-tracking"] or "";
    local MessageTail = "";


     if ( config.CitationClass == "journal" ) then
     if ( config.CitationClass == "journal" ) then
Line 704: Line 708:
     local DateIn = Date
     local DateIn = Date
      
      
     -- Test is cite web is called without giving a URL
     -- Test if cite web is called without giving a URL
     if ( config.CitationClass == "web" ) then
     if ( URL == nil or URL == '' ) and
        if ( URL == nil or URL == '' ) and
            ( ChapterURL == nil or ChapterURL == '' ) and
                ( ChapterURL == nil or ChapterURL == '' ) and
            ( ArchiveURL == nil or ArchiveURL == '' ) and                 
                ( ArchiveURL == nil or ArchiveURL == '' ) and                 
            ( ConferenceURL == nil or ConferenceURL == '' ) and                 
                ( ConferenceURL == nil or ConferenceURL == '' ) and                 
            ( TranscriptURL == nil or TranscriptURL == '' ) then
                ( TranscriptURL == nil or TranscriptURL == '' ) 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' );
             if Title == nil or Title == "" then  
             if MessageTail ~= '' then
                 Authors = Authors .. hiddencomment("No URL on cite web here");  
                 MessageTail = MessageTail .. ", no URL on cite web";
             else
             else
                 Title = Title .. hiddencomment("No URL on cite web here");
                 MessageTail = MessageTail .. "No URL on cite web";
             end
             end
         end
         end
        if ( AccessDate ~= nil and AccessDate ~= '' ) then
            table.insert( z.error_categories, 'Pages using citations with accessdate and no URL' );
            AccessDate = nil;
            if MessageTail ~= '' then
                MessageTail = MessageTail .. ", accessdate used without URL";
            else
                MessageTail = MessageTail .. "Accessdate used without URL";
            end
        end       
     end     
     end     


Line 726: Line 739:
             ( Conference == nil or Conference == "" ) then
             ( Conference == nil or Conference == "" ) then
         table.insert( z.error_categories, 'Pages with citations lacking titles' );
         table.insert( z.error_categories, 'Pages with citations lacking titles' );
         Authors = Authors .. hiddencomment("No citation title here");
         if MessageTail ~= '' then
            MessageTail = MessageTail .. ", citation has no title";
        else
            MessageTail = MessageTail .. "Citation has no title";  
        end
     end
     end


Line 853: Line 870:
     if ( Volume ~= nil and Volume ~="" )
     if ( Volume ~= nil and Volume ~="" )
     then
     then
         if ( string.len(Volume) > 4 )
         if ( mw.ustring.len(Volume) > 4 )
           then Volume = sepc .." " .. Volume
           then Volume = sepc .." " .. Volume
           else Volume = " <b>" .. Volume .. "</b>"
           else Volume = " <b>" .. hyphentodash(Volume) .. "</b>"
         end
         end
     else Volume = "" end
     else Volume = "" end
Line 1,153: Line 1,170:
     local OCinS = createTag({name="span", contents=empty_span, params={class="Z3988",title=OCinStitle }})  
     local OCinS = createTag({name="span", contents=empty_span, params={class="Z3988",title=OCinStitle }})  
     text = text .. OCinS;
     text = text .. OCinS;
   
    if MessageTail ~= '' then
        text = text .. hiddencomment( MessageTail );
    end
      
      
     if no_tracking_cats == '' then
     if no_tracking_cats == '' then
Anonymous user