1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#! /usr/bin/perl -w
#
# $Id: fixhtml,v 1.8 2003/09/25 03:30:21 wohler Exp $
#
# NAME
# fixhtml - prepare MH-E's HTML documentation
#
# SYNOPSIS
# fixhtml
#
# DESCRIPTION
# This program fixes up the output of texi2html specifically for MH-E.
#
# OPTIONS
#
# RETURNS
#
# BUGS
#
# AUTHOR
# Copyright 1999,2001 Bill Wohler <wohler@newt.com>, Newt Software
use strict;
#
# Initializations (internal variables that need to be set to something).
#
select((select(STDOUT), $| = 1)[0]);
# Bring in other files.
print "Renaming index.html to Table-of-Contents.html.\n";
rename("index.html", "Table-of-Contents.html") or die;
print "Copying index.html.\n";
system "cp ../index.html .";
print "Copying indexes.html.\n";
system "cp ../indexes.html .";
# Fix up various HTML things.
print "Playing around with Texinfo output.\n";
fix_texinfo_html();
# Link to a well-known files that are used by the rest of the MH book.
print "Linking tour.html to Tour-Through-MH-E.html.\n";
symlink "Tour-Through-MH-E.html", "tour.html";
print "Linking getmhe.html to Getting-MH-E.html.\n";
symlink "Getting-MH-E.html", "getmhe.html";
# Set the mode to read-only to be consistent with other files and because
# Jerry has a script that checks the mode of the index.html file.
chmod 0444, <*.html>;
sub fix_texinfo_html {
while (<*.html>) {
my $current_file = $_;
open(HTML, $current_file) or die;
open(HTMLOUT, ">.$current_file") or die;
select(HTMLOUT);
while (<HTML>) {
s/<body>/<body bgcolor="#FFFFFF">/i;
s/index.html/Table-of-Contents.html/;
}
continue {
print;
}
close(HTML) or die;
close(HTMLOUT) or die;
select(STDOUT) or die;
rename(".$current_file", "$current_file") or die;
}
}
|