Jump to content

Module:Citation/CS1: Difference between revisions

sync to sandbox, addresses handling of trans-title with no title. Also fixes to COinS for encyclopedia mode.
m>Dragons flight
(sync to sandbox, addresses archiveurl= error handling)
m>Dragons flight
(sync to sandbox, addresses handling of trans-title with no title. Also fixes to COinS for encyclopedia mode.)
Line 440: Line 440:
             Chapter = args.article
             Chapter = args.article
             TransChapter = TransTitle
             TransChapter = TransTitle
             Title = ""           
             Title = nil         
            TransTitle = nil
         elseif ( Chapter == nil or Chapter == '' ) then
         elseif ( Chapter == nil or Chapter == '' ) then
             if Title ~= args.encyclopedia then  
             if Title ~= args.encyclopedia then  
                 Chapter = Title
                 Chapter = Title
                 TransChapter = TransTitle
                 TransChapter = TransTitle
                 Title = ""           
                 Title = nil
                TransTitle = nil
             end
             end
         end
         end
         if ( Periodical and Periodical ~= "") then
         if ( Periodical and Periodical ~= "") then
             if Periodical == Title or Periodical == Chapter then Periodical = '' end
             if Periodical == Title or Periodical == Chapter then Periodical = nil end
         end
         end
     end
     end
Line 775: Line 777:
             ( Title == nil or Title == "" ) and
             ( Title == nil or Title == "" ) and
             ( Periodical == nil or Periodical == "" ) and
             ( Periodical == nil or Periodical == "" ) and
             ( Conference == nil or Conference == "" ) then
             ( Conference == nil or Conference == "" ) and
            ( TransTitle == nil or TransTitle == "" ) and
            ( 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( MessageTail, 'Citation has no title' );
Line 790: Line 794:
         end
         end
     end
     end
     if ( TransTitle and "" < TransTitle ) then TransTitle = " [" .. TransTitle .. "&#93;" else TransTitle = "" end
     if ( TransTitle and "" < TransTitle ) then TransTitle = " [" .. TransTitle .. "&#93;" else TransTitle = "" end
     if ( TransChapter and "" < TransChapter ) then TransChapter = " [" .. TransChapter .. "&#93;" else TransChapter = "" end
     if ( TransChapter and "" < TransChapter ) then TransChapter = " [" .. TransChapter .. "&#93;" else TransChapter = "" end
     if ( Chapter and "" < Chapter ) then
       
    -- Format chapter / article title
     if ( Chapter ~= nil and Chapter ~= "" ) then
         if ( ChapterLink and "" < ChapterLink ) then Chapter = "[[" .. ChapterLink .. "|" .. Chapter .. "]]" end
         if ( ChapterLink and "" < ChapterLink ) then Chapter = "[[" .. ChapterLink .. "|" .. Chapter .. "]]" end
         if ( Periodical and "" < Periodical ) and (Title ~= nil and Title ~= "" )
         if ( Periodical and "" < Periodical ) and (Title ~= nil and Title ~= "" )
Line 800: Line 807:
             Chapter = "\"" .. Chapter .. "\""
             Chapter = "\"" .. Chapter .. "\""
         end
         end
         Chapter = Chapter .. TransChapter
    else
         Chapter = "";
    end
    if TransChapter ~= "" and Chapter == "" then
        table.insert( z.error_categories, 'Pages with citations using translated terms without the original' );
        TransChapter = TransChapter .. hiddencomment( "Translated title included without the original" );
    end
    Chapter = Chapter .. TransChapter
    if Chapter ~= "" then
         if ( ChapterLink == nil ) then
         if ( ChapterLink == nil ) then
             if ( ChapterURL and "" < ChapterURL ) then
             if ( ChapterURL and "" < ChapterURL ) then
Line 811: Line 826:
         end
         end
         Chapter = Chapter .. sepc .. " " -- with end-space
         Chapter = Chapter .. sepc .. " " -- with end-space
    else
        Chapter = ""
     end
     end
   
    -- Format main title.
     if ( Title and "" < Title ) then
     if ( Title and "" < Title ) then
         if ( TitleLink and "" < TitleLink ) then
         if ( TitleLink and "" < TitleLink ) then
Line 826: Line 841:
             Title = "''" .. safeforitalics(Title) .. "''"
             Title = "''" .. safeforitalics(Title) .. "''"
         end
         end
         Title = Title .. TransTitle
    else
         Title = "";
    end   
    if TransTitle ~= "" and Title == "" then
        table.insert( z.error_categories, 'Pages with citations using translated terms without the original' );
        TransTitle = TransTitle .. hiddencomment( "Translated title included without the original" );
    end
    Title = Title .. TransTitle
    if Title ~= "" then
         if ( TitleLink == nil and URL and "" < URL ) then  
         if ( TitleLink == nil and URL and "" < URL ) then  
             Title = "[" .. URL .. " " .. safeforurl( Title ) .. "]" .. Format
             Title = "[" .. URL .. " " .. safeforurl( Title ) .. "]" .. Format
Line 832: Line 855:
             Format = ''
             Format = ''
         end
         end
    else
        Title = ""
     end
     end
     if ( Conference ~= nil and Conference ~="" ) then
     if ( Conference ~= nil and Conference ~="" ) then
         if ( ConferenceURL ~= nil ) then
         if ( ConferenceURL ~= nil ) then
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.