link-checker commit: Check applet and object archive links.

changeset:   399:a95ba6e2f870
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Sat Apr 02 20:26:54 2011 +0300
files:       NEWS bin/checklink
description:
Check applet and object archive links.


diff -r 73c47eae2569 -r a95ba6e2f870 NEWS
--- a/NEWS	Sat Apr 02 19:23:01 2011 +0300
+++ b/NEWS	Sat Apr 02 20:26:54 2011 +0300
@@ -7,6 +7,7 @@
 - Clarify output wrt. links that have already been checked.
 - Make connection cache size configurable, and increase the default to 2.
 - Move JavaScript to an external file.
+- Check applet and object archive links.
 
 Version 4.7
 - Support for IRI.
diff -r 73c47eae2569 -r a95ba6e2f870 bin/checklink
--- a/bin/checklink	Sat Apr 02 19:23:01 2011 +0300
+++ b/bin/checklink	Sat Apr 02 20:26:54 2011 +0300
@@ -268,18 +268,19 @@
     video  => ['src', 'poster'],
 };
 
-# Tag=>attribute mapping of things we treat as space separated lists of links.
+# Tag=>[separator, attributes] mapping of things we treat as lists of links.
 use constant LINK_LIST_ATTRS => {
-    a    => ['ping'],
-    area => ['ping'],
-    head => ['profile'],
+    a      => [qr/\s+/,    ['ping']],
+    applet => [qr/[\s,]+/, ['archive']],
+    area   => [qr/\s+/,    ['ping']],
+    head   => [qr/\s+/,    ['profile']],
+    object => [qr/\s+/,    ['archive']],
 };
 
 # TBD/TODO:
-# - applet/@archive, @code?
+# - applet/@code?
 # - bgsound/@src?
 # - object/@classid?
-# - object/@archive?
 # - isindex/@action?
 # - layer/@background,@src?
 # - ilayer/@background?
@@ -2047,6 +2048,10 @@
         elsif ($tag eq 'applet' || $tag eq 'object') {
             if (my $codebase = $attr->{codebase}) {
 
+                # Applet codebases are directories, append trailing slash
+                # if it's not there so that new_abs does the right thing.
+                $codebase .= "/" if ($tag eq 'applet' && $codebase !~ m|/$|);
+
                 # TODO: HTML 4 spec says applet/@codebase may only point to
                 # subdirs of the directory containing the current document.
                 # Should we do something about that?
@@ -2063,9 +2068,10 @@
 
         # List of links attributes:
         if (my $link_attrs = LINK_LIST_ATTRS()->{$tag}) {
-            for my $la (@$link_attrs) {
+            my ($sep, $attrs) = @$link_attrs;
+            for my $la (@$attrs) {
                 if (defined(my $value = $attr->{$la})) {
-                    for my $link (split(/\s+/, $value)) {
+                    for my $link (split($sep, $value)) {
                         $self->add_link($link, $tag_local_base, $line);
                     }
                 }

Received on Saturday, 2 April 2011 17:53:20 UTC