File:  [LON-CAPA] / doc / build / generate_web_pages.pl
Revision 1.2: download - view: text, annotated - select for diffs
Tue Aug 19 14:36:10 2003 UTC (21 years, 2 months ago) by bowersj2
Branches: MAIN
CVS tags: HEAD
Whoops, don't want this.

#!/usr/bin/perl -w

=pod

=NAME

generate_web_pages.pl - generate the web pages for the install site

=SYNOPSIS

Yeah, it does that.

Basically, there's a few comments in shell.html that we replace with
    what we really want in the files. Pretty simple.

The point of this is to look like the main site.

=cut

# This is the list of pages to generate: Change this to
# add/subtract/etc. pages. Index is done seperately.
# Title, source

my @pages = ( 
	      ['Red Hat 7.3 Install', 'rh73'],
	      ['Manual Install from Tarballs', 'manual_install'],
	      ['Upgrading from Previous LON-CAPA install', 'upgrade'],
	      ['Post-installation Configuration', 'config'],
	      ['LON-CAPA License (Gnu Public License)', 'license']
	      );

open SHELL, '<', "shell.html";
my $shell = join '', <SHELL>;
$shell =~ s/\r/\n/g;

# Call with: The title, breadcrumb, and content
sub replaceText {
    my ($title, $breadcrumb, $content) = @_;

    my $page = $shell;
    $page =~ s/\<!-- *title *--\>/$title/g;
    $page =~ s/\<!-- *breadcrumb *--\>/$breadcrumb/g;
    $page =~ s/\<!-- *content *--\>/$content/g;

    return $page;
}

# Do the index page

open INDEX, '>', "index.html";
my $content = <<PRELUDE;
<p>LON-CAPA is based upon a lot of Open Source modules, so it's important
to have the right environment on your computer. Since it will frequently 
be the case that LON-CAPA will be going onto a dedicated machine, we've 
included instructions for installing LON-CAPA concurrently with new
installations of some of the popular Linux distributions.</p>

<p>A tarball installation is also available for those who wish to 
install on other distributions. Currently, Apache 1.x is required;
LON-CAPA does not yet run on 2.0.</p>

<p>For all distributions, please see how to 
<a href="config.html">configure the server after installation</a>.</p>
PRELUDE

$content .= "<ul>\n";
for (@pages) {
    $content .= "<li><a href='$_->[1].html'>$_->[0]</a></li>\n";
}

$content .= "</ul>\n";

my $index = replaceText("Install LON-CAPA", "Install LON-CAPA",
    $content);
print INDEX $index;
close INDEX;

# Build the pages
for (@pages) {
    my ($title, $source) = @$_;

    # read in content
    open SOURCE, '<', $source.'.frag';
    $content = join '', <SOURCE>;
    close SOURCE;

    $content = replaceText($title, '<a href="/">Install LON-CAPA</a> &gt; ' . $title,
			   $content);
    open DEST, '>', $source.'.html';
    print DEST $content;
    close DEST;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>