You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by fi...@apache.org on 2007/10/11 08:29:37 UTC

svn commit: r583689 - /labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl

Author: fielding
Date: Wed Oct 10 23:29:35 2007
New Revision: 583689

URL: http://svn.apache.org/viewvc?rev=583689&view=rev
Log:
script to easily extract all tables of content


Added:
    labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl   (with props)

Added: labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl
URL: http://svn.apache.org/viewvc/labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl?rev=583689&view=auto
==============================================================================
--- labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl (added)
+++ labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl Wed Oct 10 23:29:35 2007
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+#
+# read each line from each HTML file on command-line
+# looking for table of contents.  print only the ToC
+# with substitutions for an external outline jump table.
+
+$intoc = 0;
+$title = "";
+
+while (<>) {
+    if ($intoc) {
+        s/<a href="\#/<a href="$ARGV\#/g;
+        print;
+        if (m:^      </ul>:o) {
+            $intoc = 0;
+        }
+    }
+    else {
+        if (/^      <p class="title">([^<]*)</o) {
+            $title = $1;
+        }
+        elsif (/<a href="#rfc\.toc">Table of Contents/o) {
+            print "\n<h2><a href=\"$ARGV\">$title</a></h2>\n";
+            $intoc = 1;
+            $title = "";
+        }
+    }
+}

Propchange: labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: labs/webarch/trunk/http/draft-fielding-http/extract_outline.pl
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org