source: draft-ietf-httpbis/03/extract_outline.pl @ 872

Last change on this file since 872 was 264, checked in by julian.reschke@…, 12 years ago

Prepare for release of draft 03 on Tuesday, 2008-06-17.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 654 bytes
Line 
1#!/usr/bin/perl
2#
3# read each line from each HTML file on command-line
4# looking for table of contents.  print only the ToC
5# with substitutions for an external outline jump table.
6
7$intoc = 0;
8$title = "";
9
10while (<>) {
11    if ($intoc) {
12        s/<a href="\#/<a href="$ARGV\#/g;
13        print;
14        if (m:^      </ul>:o) {
15            $intoc = 0;
16        }
17    }
18    else {
19        if (/^      <p class="title">([^<]*)</o) {
20            $title = $1;
21        }
22        elsif (/<a href="#rfc\.toc">Table of Contents/o) {
23            print "\n<h2><a href=\"$ARGV\">$title</a></h2>\n";
24            $intoc = 1;
25            $title = "";
26        }
27    }
28}
Note: See TracBrowser for help on using the repository browser.