Example script: buildframeset.ksh


   1: #!/bin/ksh
   2: #
   3: # $Header: /afs/northstar/ufac/richard/projects/class-web-builder/RCS/buildframeset,v 1.9 2005/03/18 19:23:07 richard Exp $
   4: #
   5: # Build a frameset page for a class web site.  Usually this is put in index.html.
   6: # This script is used in conjunction with buildhtml and buildslidelist.
   7: #
   8: # Optional -bBASE defines the base URL to use.  
   9: # e.g. -b "http://www.dartmouth.edu/${PWD#/data/public/}/"
  10: # If no baseurl is set, skip it.  We don't really need to set this 
  11: # and it makes it easier to move the whole site around without it.
  12: #
  13: # Expected argument ($1) is the introduction page.
  14: #
  15: # 2001/10 Richard Brittain, Dartmouth College
  16: 
  17: # Solaris has two versions of grep - make sure we get the right one by tweeking $PATH
  18: PATH=/usr/xpg4/bin:$PATH; export PATH
  19: 
  20: # Make sure we get these only from the .conf file
  21: unset author keywords description
  22: 
  23: # Read in the config file setting various optional features.  Look only in the current directory
  24: # This can preset several variables used later in this script.
  25: [[ -r ./buildhtml.conf ]] && . ./buildhtml.conf
  26: frametype=${frametype:-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\" \"http://www.w3.org/TR/REC-html40/frameset.dtd\">"}
  27: 
  28: baseurl=
  29: while getopts b: o ; do
  30:    case $o in
  31:    b) baseurl=$OPTARG;;
  32:    esac
  33: done
  34: shift $OPTIND-1
  35: 
  36: # Get the "class" title from the TITLE of the introduction page
  37: # We'll use this in the printable version
  38: intro=$1
  39: if [[ -r "$intro" ]] ; then
  40:    ctitle=$(grep -i '<TITLE' $intro | sed -e 's/.*<[tT][iI][tT][lL][eE]>//' -e 's/<\/[tT][iI][tT][lL][eE]>.*//')
  41: else
  42:    # Oops - well just use a generic title
  43:    ctitle="Online Class Notes"
  44: fi
  45: 
  46: print "$frametype"
  47: print '<html>'
  48: print '<!-- This was created automatically by buildhtml - do not edit -->'
  49: [[ -n "$author" ]]      && print '<meta name="AUTHOR" content="'"$author"'">'
  50: [[ -n "$keywords" ]]    && print '<meta name="keywords" content="'"$keywords"'">'
  51: [[ -n "$description" ]] && print '<meta name="description" content="'"$description"'">'
  52: print '<head>'
  53: print '<title>'$ctitle'</title>'
  54: if [[ ! -z "$baseurl" ]]; then
  55:   print '<base href="'$baseurl'">'
  56: fi
  57: 
  58: # Use .html for the slide lists -- no subtopic expansion unless requested
  59: 
  60: print '<frameset cols="240, *">'
  61: print '   <noframes>'
  62: print '      These pages are best viewed with a frames-capable browser.<br>'
  63: print '      <a href="print_pages.shtml">Printable version (single file)</a>'
  64: print '      <a href="slide_list_noframes.shtml">No frames version</a>'
  65: print '   </noframes>'
  66: print '   <frame src="slide_list.html" name="menu" >'
  67: print '   <frame src='"$intro"' name="mainplusnav">'
  68: print '</frameset>'
  69: print '</head>'
  70: print '</html>'
  71: exit 0



  last modified 09/02/2006 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College