W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2010

link-checker commit: Output number of lines processed instead of total number of lines in docs.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:47:12 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1iy-00060N-Px@blinky.w3.org>
changeset:   218:26464e87e9ca
user:        ville
date:        Sun Feb 10 13:25:21 2008 +0000
files:       bin/checklink
description:
Output number of lines processed instead of total number of lines in docs.


diff -r 8cd754dbbe4c -r 26464e87e9ca bin/checklink
--- a/bin/checklink	Sun Feb 10 13:20:11 2008 +0000
+++ b/bin/checklink	Sun Feb 10 13:25:21 2008 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2008 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.88 2008-02-10 13:20:11 ville Exp $
+# $Id: checklink,v 4.89 2008-02-10 13:25:21 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -244,7 +244,7 @@
   $PROGRAM     = 'W3C-checklink';
   $VERSION     = '4.3';
   $REVISION    = sprintf('version %s (c) 1999-2008 W3C', $VERSION);
-  my ($cvsver) = q$Revision: 4.88 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver) = q$Revision: 4.89 $ =~ /(\d+[\d\.]*\.\d+)/;
   $AGENT       = sprintf('%s/%s [%s] %s',
                          $PROGRAM, $VERSION, $cvsver, LWP::RobotUA->_agent());
 
@@ -1335,9 +1335,12 @@
     $start = &get_timestamp();
     print("Parsing...\n");
   }
-  if (!$Opts{Summary_Only} || $Opts{Progress}) {
-    $p->{Total} = ($$docref =~ tr/\n//);
-  }
+
+  # Count lines beforehand if needed for progress indicator.  In all cases,
+  # the actual final number of lines processed shown is populated by our
+  # end_document handler.
+  $p->{Total} = ($$docref =~ tr/\n//) if $Opts{Progress};
+
   # We only look for anchors if we are not interested in the links
   # obviously, or if we are running a recursive checking because we
   # might need this information later
@@ -1386,6 +1389,7 @@
               }, 'self, text, line');
   # Other stuff
   $p->handler(default => 'parse_progress', 'self, line') if $Opts{Progress};
+  $p->handler(end_document => 'end_document', 'self, line');
   # Check <a [..] name="...">?
   $p->{check_name} = 1;
   # Check <[..] id="..">?
@@ -1533,6 +1537,13 @@
 
   $self->text($text) unless $self->{only_anchors};
 
+  return;
+}
+
+sub end_document
+{
+  my ($self, $line) = @_;
+  $self->{Total} = $line;
   return;
 }
 
Received on Thursday, 5 August 2010 14:47:32 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:44 UTC