W3C home > Mailing lists > Public > www-validator-cvs@w3.org > June 2004

perl/modules/W3C/LinkChecker/bin checklink,3.52,3.53

From: Ville Skytta <ville@dev.w3.org>
Date: Wed, 02 Jun 2004 19:02:23 +0000
To: www-validator-cvs@w3.org
Message-Id: <20040602190223.9C63D4A853@hutz.w3.org>

Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv26474

Modified Files:
	checklink 
Log Message:
Switch to HTML 4.01 strict, and make related adjustments and layout
consistency improvements mainly to error message views.


Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 3.52
retrieving revision 3.53
diff -u -d -r3.52 -r3.53
--- checklink	2 Jun 2004 16:03:00 -0000	3.52
+++ checklink	2 Jun 2004 19:02:21 -0000	3.53
@@ -86,7 +86,7 @@
 package W3C::LinkChecker;
 
 use vars qw($AGENT $PACKAGE $PROGRAM $VERSION $REVISION
-            $DocType $Meta $Accept $ContentTypes %Cfg);
+            $DocType $Head $Accept $ContentTypes %Cfg);
 
 use HTML::Entities       qw();
 use HTML::Parser    3.00 qw();
@@ -124,11 +124,6 @@
     require Apache;
   }
 
-  $DocType = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
-
-  $Meta = '<meta http-equiv="Content-Script-Type" ' .
-    'content="application/x-javascript">';
-
   my @content_types = qw(application/xhtml+xml text/html);
   $Accept = join(', ', @content_types) . ', */*;q=0.5';
   my $re = join('|', map { s/\+/\\+/g; $_ } @content_types);
@@ -170,6 +165,11 @@
   $Cfg{Style_URI} ||=
     'http://validator.w3.org/docs/linkchecker.css';
 
+  $DocType = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">';
+  $Head = <<EOF;
+<meta http-equiv="Content-Script-Type" content="application/x-javascript">
+<link rel="stylesheet" type="text/css" href="$Cfg{Style_URI}">
+EOF
 
   # Trusted environment variables that need laundering in taint mode.
   foreach (qw(NNTPSERVER NEWSHOST)) {
@@ -1407,14 +1407,13 @@
     printf("%s
 <html lang=\"en\">
 <head>
-<title>401 Authorization Required</title>
-%s
-</head>
-<body>
-<h1>Authorization Required</h1>
-<p>
-  You need %s access to %s to perform Link Checking.<br>
-", $DocType, $Meta, &encode($realm), $r->request->url);
+<title>W3C Link Checker: 401 Authorization Required</title>
+%s</head>
+<body>", $DocType, $Head);
+    &banner(': 401 Authorization Required');
+    printf("<p>
+  You need %s access to <a href=\"%s\">%s</a> to perform link checking.<br>
+", &encode($realm), (&encode($r->request()->url())) x 2);
 
     if ($Opts{Trusted}) {
       printf <<EOF, &encode($Opts{Trusted});
@@ -1955,8 +1954,8 @@
 {
   my ($uri, $doform, $cookie) = @_;
 
-  $uri = &encode($uri);
-  my $title = ' Link Checker' . ($uri eq '' ? '' : ': ' . $uri);
+  my $title = defined($uri) ? $uri : '';
+  $title = ': ' . $title if ($title =~ /\S/);
 
   # mod_perl 1.99_05 doesn't seem to like if the "\n\n" isn't in the same
   # print() statement as the last header...
@@ -1971,15 +1970,15 @@
 
   my $script = my $onload = '';
   if ($doform) {
-    $script = "
-<script type=\"application/x-javascript\">
+    $script = <<'EOF';
+<script type="application/x-javascript">
 function uriOk()
 {
   var u = document.forms[0].uri;
   var ok = false;
   if (u.value.length > 0) {
     if (u.value.search) {
-      ok = (u.value.search(/\\S/) != -1);
+      ok = (u.value.search(/\S/) != -1);
     } else {
       ok = true;
     }
@@ -1987,27 +1986,32 @@
   if (! ok) u.focus();
   return ok;
 }
-</script>";
+</script>
+EOF
    $onload = ' onload="document.forms[0].uri.focus()"';
   }
 
   print $headers, $DocType, "
 <html lang=\"en\">
 <head>
-<title>W3C", $title, "</title>
-", $Meta, "
-<link rel=\"stylesheet\" type=\"text/css\" href=\"",$Cfg{Style_URI},"\">", $script, "
-</head>
-<body", $onload, ">
-    <div id=\"banner\"><h1 id=\"title\"><a href=\"http://www.w3.org/\" title=\"W3C\"><img alt=\"W3C\" 
-id=\"logo\" src=\"http://www.w3.org/Icons/w3c_home\" height=\"48\" width=\"72\"></a> ", $title, "</h1></div>\n\n",
-'<ul class="navbar" id="menu">
-  <li><span class="hideme"><a href="#skip" accesskey="s" title="Skip past navigation to main part of page">Skip Navigation</a> |</span>',"
-  <li><a href=\"",$Cfg{Doc_URI},'" title="Documentation for this Link Checker Service">Docs</a></li>
-   <li><a href="http://search.cpan.org/dist/W3C-LinkChecker/" title="Download the source / Install this service ">Download</a></li>
-   <li><a href="http://validator.w3.org" accesskey="h" title="Validate your markup with the  W3C Markup Validation Service">Validator</a></li>
+<title>W3C Link Checker", &encode($title), "</title>
+", $Head, $script, "</head>
+<body", $onload, '>';
+  &banner($title);
+}
+
+sub banner ($)
+{
+  my ($title) = @_;
+  printf(<<'EOF', &encode($title), $Cfg{Doc_URI});
+<div id="banner"><h1 id="title"><a href="http://www.w3.org/" title="W3C"><img alt="W3C" id="logo" src="http://www.w3.org/Icons/w3c_home" height="48" width="72"></a> Link Checker%s</h1></div>
+<ul class="navbar" id="menu">
+  <li><span class="hideme"><a href="#skip" accesskey="s" title="Skip past navigation to main part of page">Skip Navigation</a> |</span>
+  <li><a href="%s" title="Documentation for this Link Checker Service">Docs</a></li>
+  <li><a href="http://search.cpan.org/dist/W3C-LinkChecker/" title="Download the source / Install this service">Download</a></li>
+  <li><a href="http://validator.w3.org/" accesskey="h" title="Validate your markup with the W3C Markup Validation Service">Validator</a></li>
 </ul>
-';
+EOF
 }
 
 sub bgcolor ($)
Received on Wednesday, 2 June 2004 15:02:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:06 UTC