#!/bin/sh ###################################################################### # tirframe - Generate tir HTML document with frame elements for # content in standart input. # Created 2006-8-13 by David Meyer. # 2007-05-14 Version 0.1.x1 - Experiment to achieve recent # design goals with minimal code changes. ###################################################################### # Identification ##################################################### PROGRAM='tirframe (Tears in Rain)' VERSION=0.1.x1 COPYRIGHT='Copyright (C) 2006 David Meyer' DESCRIPTION='Generate Tears in Rain HTML document with frame elements for content in standard input.' USAGE="Usage: $0 [-pVh] [DIRECTORY]" CONTACT='David Meyer ' # Initialize environment ############################################# unset IFS PATH= BASENAME=/usr/bin/basename CAT=/bin/cat ECHO=/bin/echo SED=/bin/sed : ${TIRROOT:=/mnt/card/Meyer21C} : ${TIRCSS:=$TIRROOT/.tir.css} # Arguments ########################################################## while getopts pVh option do case $option in p ) PREFORMAT=true ;; V ) $ECHO "$PROGRAM $VERSION" $ECHO $COPYRIGHT exit 0 ;; h ) $CAT << ENDHELP $USAGE $DESCRIPTION Options: -p Content of standard input is preformatted -V Display version number -h Display this help message Report bugs to $CONTACT. ENDHELP exit 0 ;; * ) $ECHO $USAGE >&2 exit 1 ;; esac done shift $(( $OPTIND-1 )) HERE=${1:-.} # Functions ########################################################## cat_filter_root_path() { if [ $HERE -ef $TIRROOT ] then $SED -e 's:\.\./:./:' $1 else $CAT $1 fi } inherit_fn() { fn=${2:?"Insufficient arguments: inherit_fn $@"} if [ -f $fn ] then eval $1=$fn elif [ -f $TIRROOT/$fn ] then eval $1=$TIRROOT/$fn else eval $1=${3:-/dev/null} fi } # Main driver ######################################################## cd $HERE test -f .title && title=`$CAT .title` test -f $TIRROOT/.title && site=`$CAT $TIRROOT/.title` # x1: use dir. entry in root dir. (look up with inode) if [ x"${title:=`$BASENAME $HERE`}" = x"." ] then title="Site under construction" fi if [ ! $HERE -ef $TIRROOT -a "$site" ] then browser_title="$title - $site" else browser_title=$title fi inherit_fn stylesheet_fn .stylesheet stylesheet=`cat_filter_root_path $stylesheet_fn` : ${stylesheet:=$TIRCSS} inherit_fn browser_icon_fn .icon inherit_fn menu1_fn .menu1 inherit_fn menu2_fn .menu2 inherit_fn nameplate_fn .nameplate /dev/null #doc_head_start $CAT << ENDHEADER1 $browser_title ENDHEADER1 #test -f $browser_icon_fn && head_icon if [ -f $browser_icon_fn ] then icon=`cat_filter_root_path $browser_icon_fn` $CAT << ENDHEADER2 ENDHEADER2 fi #test -f .style && head_style if [ -f .style ] then $ECHO '' fi #head_body_transition $ECHO '' #test -f $menu1_fn && menu1_div if [ -f $menu1_fn ] then $ECHO '' fi #nameplate_div #$CAT << ENDNAMEPLATE #
#$site #
#ENDNAMEPLATE #left_sidebar_start #$ECHO '' #main_start $ECHO '
' if [ $PREFORMAT ] then $ECHO '
'
	$SED -e 's/&/\&/g' -e 's//\>/g'
	$ECHO '
' else $CAT fi #main_end $ECHO '
' #badges_div $CAT << ENDBADGES

Valid HTML 4.01 Strict Valid CSS!

+JMJ
ENDBADGES #body_doc_end $ECHO '' exit