File:  [LON-CAPA] / doc / build / generate_web_pages.pl
Revision 1.23: download - view: text, annotated - select for diffs
Fri Sep 2 19:04:42 2005 UTC (18 years, 8 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- trying to make Gerd happy

    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.hemp 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: #	      ['Fedora Install', 'fedora_install'],
   27:               ['Fedora Core 3 Install', 'FC3_install'],
   28:               ['Fedora Core 4 Install', 'FC4_install'],
   29:               ['Red Hat Enterprise Linux 4 Install','RHEL4_install'],
   30:               ['SuSE Linux Professional 9.2 Install', 'suse9.2_install'],
   31: #	      ['Manual Install from Tarballs', 'manual_install'],
   32: 	      ['Upgrading from Previous LON-CAPA install', 'upgrade'],
   33: 	      ['LON-CAPA License (Gnu Public License)', 'license']
   34: 	      );
   35: my @other_pages = ( 
   36: 		    ['Developer Information', 'dev'],
   37: 		    ['Configuration Information', 'config'],
   38: 		    );
   39: 
   40: open SHELL, '<', "shell.html";
   41: my $shell = join '', <SHELL>;
   42: $shell =~ s/\r/\n/g;
   43: 
   44: # Call with: The title, breadcrumb, and content
   45: sub replaceText {
   46:     my ($title, $breadcrumb, $content) = @_;
   47: 
   48:     my $page = $shell;
   49:     $page =~ s/\<!-- *title *--\>/$title/g;
   50:     $page =~ s/\<!-- *breadcrumb *--\>/$breadcrumb/g;
   51:     $page =~ s/\<!-- *content *--\>/$content/g;
   52: 
   53:     return $page;
   54: }
   55: 
   56: # Do the index page
   57: 
   58: open INDEX, '>', "index.html";
   59: my $content = <<PRELUDE; 
   60: 
   61: <p>LON-CAPA is based upon a lot of Open Source modules, so it's
   62: important to have the right environment on your computer. This is most
   63: easily done by installing on a dedicated machine while installing the
   64: operating system.</p>
   65: 
   66: <p>The configuring of LON-CAPA is part of the install process of the
   67: software. However, In case something needs to be altered on isn't
   68: working here is some <a href="config.html">information on configuring
   69: LON-CAPA</a>.</p>
   70: 
   71: <hr />
   72: PRELUDE
   73: 
   74: $content .= "<ul>\n";
   75: for (@pages) {
   76:     $content .= "<li><a href='$_->[1].html'>$_->[0]</a></li>\n";
   77: }
   78: 
   79: $content .= "</ul>\n";
   80: 
   81: $content .= <<'POSTLUDE';
   82: <hr />
   83: <a name="download" />
   84: <h3>Downloading LON-CAPA</h3>
   85: 
   86: <p>
   87: <b>Current Production Release is Version LATESTVERSION.
   88: This version was released on LATESTDATE.</b>
   89: </p>
   90: <p>
   91: You can download the <b>most current production version of LON-CAPA</b> at
   92: <a href="http://install.lon-capa.org/versions/loncapa-current.tar.gz">
   93: http://install.lon-capa.org/versions/loncapa-current.tar.gz</a>
   94: (version LATESTVERSION).
   95: </p>
   96: TESTINGRELEASE_START
   97: <p>
   98: <b>Current Testing Release is Version LATESTTESTINGVERSION.
   99: This version was released on LATESTTESTINGDATE.</b>
  100: </p>
  101: <p>
  102: You can download the <b>testing version of the upcoming LON-CAPA</b> at
  103: <a href="http://install.lon-capa.org/versions/loncapa-testing.tar.gz">
  104: http://install.lon-capa.org/versions/loncapa-testing.tar.gz</a>
  105: (version LATESTTESTINGVERSION).
  106: </p>
  107: TESTINGRELEASE_END
  108: 
  109: <hr />
  110: POSTLUDE
  111: 
  112: $content .= "<ul>\n";
  113: for (@other_pages) {
  114:     $content .= "<li><a href='$_->[1].html'>$_->[0]</a></li>\n";
  115: }
  116: 
  117: $content .= "</ul>\n";
  118: 
  119: my $index = replaceText("Install LON-CAPA", "Install LON-CAPA",
  120:     $content);
  121: 
  122: print INDEX $index;
  123: close INDEX;
  124: 
  125: # Build the pages
  126: for (@pages,@other_pages) {
  127:     my ($title, $source) = @$_;
  128: 
  129:     # read in content
  130:     open SOURCE, '<', $source.'.frag';
  131:     $content = join '', <SOURCE>;
  132:     close SOURCE;
  133: 
  134:     $content = replaceText($title, '<a href="/">Install LON-CAPA</a> &gt; ' . $title,
  135: 			   $content);
  136:     open DEST, '>', $source.'.html';
  137:     print DEST $content;
  138:     close DEST;
  139: }

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