Module:Citation/CS1: Difference between revisions

sync to sandbox, addresses archiveurl= error handling
m>Dragons flight
(sync with sandbox. Fixes OrigYear with no Author, position of Series, and styling of cite web with Chapter. Changes default behavior of display-authors. Cleanup error message system.)
m>Dragons flight
(sync to sandbox, addresses archiveurl= error handling)
Line 523: Line 523:
           if (PMC ~= nil and PMC ~="")
           if (PMC ~= nil and PMC ~="")
             then URL="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. PMC
             then URL="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. PMC
             else URL=""
             else URL=nil
           end
           end
         end
         end
Line 784: Line 784:
      
      
     local OriginalURL = URL
     local OriginalURL = URL
    DeadURL = DeadURL:lower();
     if ( ArchiveURL and "" < ArchiveURL ) then
     if ( ArchiveURL and "" < ArchiveURL ) then
         if ( DeadURL ~= "no" ) then
         if ( DeadURL ~= "no" ) then
Line 1,009: Line 1,010:
         if ( "no" == DeadURL ) then
         if ( "no" == DeadURL ) then
             Archived = sepc .. " [" .. ArchiveURL .. arch_text .. "] from the original on" .. ArchiveDate
             Archived = sepc .. " [" .. ArchiveURL .. arch_text .. "] from the original on" .. ArchiveDate
            if OriginalURL == nil or OriginalUrl == '' then
                table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
                Archived = Archived .. " <span class='error'>If you specify <code>archiveurl=</code>" ..
                    " and <code>deadurl=no</code>, then you must also specify <code>url=</code></span>";                             
            end
         else
         else
             if OriginalURL ~= nil and OriginalURL ~= '' then
             if OriginalURL ~= nil and OriginalURL ~= '' then
                 Archived = sepc .. arch_text .. " from [" .. OriginalURL .. " the original] on" .. ArchiveDate
                 Archived = sepc .. arch_text .. " from [" .. OriginalURL .. " the original] on" .. ArchiveDate
             else
             else
                 Archived = sepc .. arch_text .. " from <span class='error'>If you specify <code>archiveurl=</code>" ..
                 if config.CitationClass ~= 'web' then
                    ", you must also specify <code>url=</code></span> on" .. ArchiveDate
                    Archived = sepc .. arch_text .. " from <span class='error'>If you specify <code>archiveurl=</code>" ..
                table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
                        ", you must also specify <code>url=</code></span> on" .. ArchiveDate
                    table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
                else
                    Archived = sepc .. arch_text .. " from the original on" .. ArchiveDate
                end
             end                 
             end                 
         end
         end
Anonymous user