? contributorlist.diff
? dist
? template.diff
? tests
? data/contributors.data
Index: catalog.pl
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/catalog.pl,v
retrieving revision 1.1
diff -u -r1.1 catalog.pl
--- catalog.pl	20 Apr 2007 14:46:21 -0000	1.1
+++ catalog.pl	13 Apr 2008 16:58:19 -0000
@@ -13,4 +13,6 @@
     indexer::index($file, $root);
 }
 
-indexer::save("tests/by-section.xht");
+indexer::saveCreditsData("data/contributors.data");
+
+indexer::saveSectionIndex("tests/by-section.xht");
\ No newline at end of file
Index: data/index.html
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/data/index.html,v
retrieving revision 1.8
diff -u -r1.8 index.html
--- data/index.html	12 Apr 2008 02:36:14 -0000	1.8
+++ data/index.html	13 Apr 2008 16:58:19 -0000
@@ -15,12 +15,10 @@
 
   <p>Many thanks to the following for their contributions:</p>
   <ul>
-    <li>Alan Harder</li>
-    <li>Bert Bos</li>
-    <li>Boris Zbarsky</li>
-    <li>David Baron</li>
-    <li>Ian Hickson</li>
-    <li>Lachlan Hunt</li>
+[%- USE contributors = datafile("${path}contributors.data", delim = '	') %]
+[%- FOREACH person = contributors %]
+    <li>[% person.name %]</li>
+[%- END %]
   </ul>
   <p>...and all the <a href="http://www.w3.org/Style/CSS/Test/CSS1/current/tsack.html">contributors
   to the CSS1 test suite</a>.</p>
Index: data/index.xht
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/data/index.xht,v
retrieving revision 1.8
diff -u -r1.8 index.xht
--- data/index.xht	12 Apr 2008 02:36:14 -0000	1.8
+++ data/index.xht	13 Apr 2008 16:58:19 -0000
@@ -15,12 +15,10 @@
 
   <p>Many thanks to the following for their contributions:</p>
   <ul>
-    <li>Alan Harder</li>
-    <li>Bert Bos</li>
-    <li>Boris Zbarsky</li>
-    <li>David Baron</li>
-    <li>Ian Hickson</li>
-    <li>Lachlan Hunt</li>
+[%- USE contributors = datafile("${path}contributors.data", delim = '	') %]
+[%- FOREACH person = contributors %]
+    <li>[% person.name %]</li>
+[%- END %]
   </ul>
   <p>...and all the <a href="http://www.w3.org/Style/CSS/Test/CSS1/current/tsack.html">contributors
   to the CSS1 test suite</a>.</p>
Index: lib/indexer.pm
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/lib/indexer.pm,v
retrieving revision 1.5
diff -u -r1.5 indexer.pm
--- lib/indexer.pm	22 Aug 2007 06:11:10 -0000	1.5
+++ lib/indexer.pm	13 Apr 2008 16:58:20 -0000
@@ -2,6 +2,7 @@
 package indexer;
 use strict;
 use utf8;
+use Template;
 
 # Usage:
 # init('Spec Root URL', 'path/to/template.xht', 'Test Suite Title: ')
@@ -34,6 +35,14 @@
               'scroll' => '<abbr title="Test Only Valid for Continuous Media">S</abbr>',
               'svg' => '<abbr title="Requires SVG Support">V</abbr>');
 
+# Template Engine
+
+my $libroot = $INC{'indexer.pm'};
+$libroot =~ s/indexer.pm//;
+my $tt = Template->new({ INCLUDE_PATH => $libroot . 'templates/' }) || die "$Template::ERROR\n";
+
+# Local Data
+
 my %testdata = ();
 my %linkindex = ();
 
@@ -54,24 +63,21 @@
   my $title = '';
   my $flags = '';
   my $links = [];
+  my $credits = [];
   my %data = ();
 
-  if ($id =~ m/^t(\d\d)(\d\d)?(\d\d)?-[a-z0-9\-]+-([a-f])(?:-([a-z]+))?$/) {
+  # Collect Metadata
 
-    # Collect Metadata
+  ($title, $links, $flags, $credits) = getHeadData($file, $id);
+  $data{'title'} = $title;
+  $data{'links'} = $links;
+  $data{'primary'} = $links->[0];
+  $data{'flags'} = $flags;
+  $data{'credits'} = $credits;
+  if ($id =~ m/^t(\d\d)(\d\d)?(\d\d)?-[a-z0-9\-]+-([a-f])(?:-([a-z]+))?$/) {
     $data{'flags'} = $5 || '';
-
-    ($title, $links, $flags) = getHeadData($file, $id);
-    $data{'title'} = $title;
-    $data{'links'} = $links;
-    $data{'primary'} = ${$links}[0];
   }
   elsif ($id =~ m/^[a-z\-]+-\d\d\d$/) {
-    ($title, $links, $flags) = getHeadData($file, $id);
-    $data{'title'} = $title;
-    $data{'links'} = $links;
-    $data{'primary'} = ${$links}[0];
-    $data{'flags'} = $flags;
   }
   else {
     print "!! Filename fails format test: $id\n";
@@ -98,6 +104,7 @@
   close FILE;
 
   my @links = ();
+  my %credits = ();
   my $title = $id;
   my $flags = '';
   if ($contents =~ /<head.*?>(.*)<\/head\s*>/sm) {
@@ -119,15 +126,46 @@
       }
     }
 
+    # Collect rel="author" information
+    my @credits = /<link\s[^>]*?rel="\s*author\s*"[^>]*?>/gsm;
+    foreach (@credits) {
+      my $url;
+      if (/href="\s*(.+?)\s*"/) {
+        $url = $1;
+      }
+      if (/title="\s*(.+?)\s*"/) {
+        $credits{$1} = $url;
+      }
+      else {
+        print "!! Missing Author Name: $_\n";
+      }
+    }
+
     # Get flags
     $flags = /<meta\s.*?name="\s*flags\s*".*?>/sm;
     $flags =~ s/\s*content="([a-zA-Z\-\s]*)"\s*/$1/sm;
   }
-  return ($title, \@links, '');
+  return ($title, \@links, $flags, \%credits);
 }
 
+sub saveCreditsData {
+  my $output = shift @_;
+
+  my %credits;
+  foreach my $test (values %testdata) {
+    foreach my $name (keys %{$test->{'credits'}}) {
+      $credits{$name} ||= $test->{'credits'}->{$name}
+        if ($name ne 'CSS1 Test Suite Contributors');
+    } 
+  }
+
+  $tt->process('contributors.data.tmpl',
+               { contributors => \%credits },
+               $output)
+  || die $tt->error(), "\n";
+}
 
-sub save {
+sub saveSectionIndex {
   my $output = shift @_;
 
   open TMPL, $template or die "index::sections could not open template $template: $!";
Index: lib/templates/contributors.data.tmpl
===================================================================
RCS file: lib/templates/contributors.data.tmpl
diff -N lib/templates/contributors.data.tmpl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lib/templates/contributors.data.tmpl	13 Apr 2008 16:58:20 -0000
@@ -0,0 +1,4 @@
+name	url
+[% FOREACH person IN contributors -%]
+[% person.key %]	[% person.value %]
+[% END -%]

