[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnu-arch-users] Tutorial as one big page
From: |
Zack Brown |
Subject: |
[Gnu-arch-users] Tutorial as one big page |
Date: |
Wed, 10 Sep 2003 09:14:58 -0700 |
User-agent: |
Mutt/1.5.4i |
Hi Tom,
It would be great if the tutorial were available as one big page. Here's
a really simple script that should work for that. Just invoke it as
$ onedoc htmltutorial/relative/path
and it will produce bigpage.html, containing the entire tutorial, with
all <a name>s and <a href>s adjusted to work as expected.
I'm sure your existing tools can do a better job creating one big page on
their own, but I felt like scripting it anyway.
Be well,
Zack
----------------------------------- 'onedoc' ---------------------------
#!/usr/bin/perl -w
use strict;
my $dir = shift || die "specify on the command line the directory containing
HTML docs";
open(I, "<$dir/arch.html");
open(O, ">bigpage.html");
print O "<html>\n";
print O "<head>\n";
print O "<title>The arch Version Control System</title>\n";
print O "</head>\n";
print O "<body>\n";
while($_ = <I>)
{
next unless /href="(.*?html)/;
my $basename = $1;
my $filename = "$dir/$basename";
open(F, "<$filename");
while(my $f = <F>)
{
next if $f =~ /^<\/?(html|head|title|body)/;
# this one line is just too long...
$f =~ s/(cmtrev: tree is not up-to-date \(missing latest revision
is)/$1\n /;
# fix all hrefs and names etc
$f =~ s/(<a name=")/$1$basename-/;
$f =~ s/(<a href=")(.*?)\#/$1\#$2-/;
print O $f;
}
}
print O "</body>\n";
----------------------------------- 'onedoc' ---------------------------
--
Zack Brown
- [Gnu-arch-users] Tutorial as one big page,
Zack Brown <=