Annotation of doc/build/generate_web_pages.pl, revision 1.2

1.1       bowersj2    1: #!/usr/bin/perl -w
                      2: 
                      3: =pod
                      4: 
                      5: =NAME
                      6: 
                      7: generate_web_pages.pl - generate the web pages for the install site
                      8: 
                      9: =SYNOPSIS
                     10: 
                     11: Yeah, it does that.
                     12: 
                     13: Basically, there's a few comments in shell.html that we replace with
                     14:     what we really want in the files. Pretty simple.
                     15: 
                     16: The point of this is to look like the main site.
                     17: 
                     18: =cut
                     19: 
                     20: # This is the list of pages to generate: Change this to
                     21: # add/subtract/etc. pages. Index is done seperately.
                     22: # Title, source
                     23: 
                     24: my @pages = ( 
                     25: 	      ['Red Hat 7.3 Install', 'rh73'],
                     26: 	      ['Manual Install from Tarballs', 'manual_install'],
                     27: 	      ['Upgrading from Previous LON-CAPA install', 'upgrade'],
                     28: 	      ['Post-installation Configuration', 'config'],
                     29: 	      ['LON-CAPA License (Gnu Public License)', 'license']
                     30: 	      );
                     31: 
                     32: open SHELL, '<', "shell.html";
                     33: my $shell = join '', <SHELL>;
                     34: $shell =~ s/\r/\n/g;
                     35: 
                     36: # Call with: The title, breadcrumb, and content
                     37: sub replaceText {
                     38:     my ($title, $breadcrumb, $content) = @_;
                     39: 
                     40:     my $page = $shell;
                     41:     $page =~ s/\<!-- *title *--\>/$title/g;
                     42:     $page =~ s/\<!-- *breadcrumb *--\>/$breadcrumb/g;
                     43:     $page =~ s/\<!-- *content *--\>/$content/g;
                     44: 
                     45:     return $page;
                     46: }
                     47: 
                     48: # Do the index page
                     49: 
                     50: open INDEX, '>', "index.html";
                     51: my $content = <<PRELUDE;
                     52: <p>LON-CAPA is based upon a lot of Open Source modules, so it's important
                     53: to have the right environment on your computer. Since it will frequently 
                     54: be the case that LON-CAPA will be going onto a dedicated machine, we've 
                     55: included instructions for installing LON-CAPA concurrently with new
                     56: installations of some of the popular Linux distributions.</p>
                     57: 
                     58: <p>A tarball installation is also available for those who wish to 
                     59: install on other distributions. Currently, Apache 1.x is required;
                     60: LON-CAPA does not yet run on 2.0.</p>
                     61: 
                     62: <p>For all distributions, please see how to 
                     63: <a href="config.html">configure the server after installation</a>.</p>
                     64: PRELUDE
                     65: 
                     66: $content .= "<ul>\n";
                     67: for (@pages) {
                     68:     $content .= "<li><a href='$_->[1].html'>$_->[0]</a></li>\n";
                     69: }
                     70: 
                     71: $content .= "</ul>\n";
                     72: 
                     73: my $index = replaceText("Install LON-CAPA", "Install LON-CAPA",
                     74:     $content);
                     75: print INDEX $index;
                     76: close INDEX;
                     77: 
                     78: # Build the pages
                     79: for (@pages) {
                     80:     my ($title, $source) = @$_;
                     81: 
                     82:     # read in content
                     83:     open SOURCE, '<', $source.'.frag';
                     84:     $content = join '', <SOURCE>;
                     85:     close SOURCE;
                     86: 
                     87:     $content = replaceText($title, '<a href="/">Install LON-CAPA</a> &gt; ' . $title,
                     88: 			   $content);
                     89:     open DEST, '>', $source.'.html';
                     90:     print DEST $content;
                     91:     close DEST;
                     92: }

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