File:  [LON-CAPA] / doc / build / generate_web_pages.pl
Revision 1.4: download - view: text, annotated - select for diffs
Tue Sep 2 15:45:47 2003 UTC (20 years, 8 months ago) by bowersj2
Branches: MAIN
CVS tags: HEAD
Thanks perl, but I'll pass on the interpolation.

    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: <hr />
   65: PRELUDE
   66: 
   67: $content .= "<ul>\n";
   68: for (@pages) {
   69:     $content .= "<li><a href='$_->[1].html'>$_->[0]</a></li>\n";
   70: }
   71: 
   72: $content .= "</ul>\n";
   73: 
   74: my $index = replaceText("Install LON-CAPA", "Install LON-CAPA",
   75:     $content);
   76: 
   77: $content .= <<'POSTLUDE';
   78: <hr />
   79: <a name="download" />
   80: <h3>Downloading LON-CAPA</h3>
   81: 
   82: <p>
   83: <b>Current Release is Version LATESTVERSION.
   84: This version was released on LATESTDATE.</b>
   85: </p>
   86: <p>
   87: You can download the <b>most current version of LON-CAPA</b> at
   88: <a href="http://install.lon-capa.org/versions/loncapa-current.tar.gz">
   89: http://install.lon-capa.org/versions/loncapa-current.tar.gz</a>
   90: (version LATESTVERSION).
   91: </p>
   92: <p>
   93: The <b>development release of LON-CAPA</b> is at:
   94: <a href="http://install.lon-capa.org/versions/loncapa-unstable.tar.gz">
   95: http://install.lon-capa.org/versions/loncapa-unstable.tar.gz</a>.
   96: </p>
   97: <p>
   98: To view the code development history of LON-CAPA, you will need to use the
   99: <a href="http://www.cvshome.org/">CVS</a> tool, the open standard for
  100: version control.  Please contact Helen (<a href="mailto:helen@lon-capa.org">
  101: helen@lon-capa.org</a>) to request a CVS USERNAME.
  102: </p>
  103: <p>
  104: The initial CVS commands would be:
  105: </p>
  106: <blockquote>
  107: <table bgcolor="#aaaaaa" border="1">
  108: <tr><td>
  109: <pre>
  110: export CVSROOT=:pserver:USERNAME@zaphod.lite.msu.edu:/home/cvs 
  111: cvs login 
  112: cvs co loncapa
  113: </pre>
  114: </td></tr></table>
  115: </blockquote>
  116: <p>
  117: For more information on using CVS, please visit
  118: <a href="http://www.cvshome.org/">http://www.cvshome.org/</a>
  119: or read <tt>loncom/build/readme.html</tt> after downloading
  120: the current version of LON-CAPA as described above.
  121: </p>
  122: 
  123: POSTLUDE
  124: 
  125: print INDEX $index;
  126: close INDEX;
  127: 
  128: # Build the pages
  129: for (@pages) {
  130:     my ($title, $source) = @$_;
  131: 
  132:     # read in content
  133:     open SOURCE, '<', $source.'.frag';
  134:     $content = join '', <SOURCE>;
  135:     close SOURCE;
  136: 
  137:     $content = replaceText($title, '<a href="/">Install LON-CAPA</a> &gt; ' . $title,
  138: 			   $content);
  139:     open DEST, '>', $source.'.html';
  140:     print DEST $content;
  141:     close DEST;
  142: }

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