#!/bin/bash ## Copy "NAV-CODE" from index.htm to each other webpage, preserving each page's STYLE, SCRIPT-within-head, TITLE, BODY-tag, and its body; Eugene Reimer 2008; ## REQUIREMENTS: ## each page: optional STYLE+SCRIPT-within-head tags, with SCRIPT sections contiguous; body-tag is required; CASE of these tags gets stdized to that shown; ## index.htm: style+script+meta (lowercase) for To-Be-Replicated stuff; STYLE required, SCRIPT+META optional for Unique-To-Page stuff; ## also required is HTML-comment "end nav"; (formerly /head body tags were on one line, but now stdize to being on separate lines); ## USAGE: ## webnavreplicate [-n/--nobackup] [DIRECTORY] --works in CURDIR, unless DIRECTORY-param specified; makes backups unless --nobackup specified; ## webnavreplicate [-b/--backup] [DIRECTORY] --works in CURDIR, unless DIRECTORY-param specified; makes backups if -b specified <==when nobackup DEFAULT!! ## ## The backups enable unchg-nav to undo accidents; this script is run from webput, but may be run separately when testing, or after an accident with --nobackup... BACKUP=1; ##==backup is again the DEFAULT while [ $# -gt 0 ] && [[ $1 == -* ]];do ##parse the options case "$1" in -b|--back*) BACKUP=1 ;; ##backup option (may make nobackup the default??) -n|--nob*) BACKUP= ;; ##no-backup option -v|--verb*) VERBOSE=1 ;; ##verbose-output option (unfinished) --) shift; break ;; ##ender for options esac shift; ##remove that arg done if [ $# -ge 1 ];then cd $1 || exit; fi ##==work in $1 dir, if specified if ! grep -q '
; -->
; FILES AFFECTED: ChasingBenevolencePhotos.htm LogoDesignContest-20071217.htm LogoDesignContestWinner.htm ReelGreenPhotos.htm TrailDesign.htm Vid01-EKO.htm Vid02-EKO-Subset.htm aboutdebwendon.htm announcingCharityStatus.htm links.htm news+articles.htm video-EKO-feedback.htm videos.htm video-EKO-feedback.htm: centering not working DUE to its not using nav1 (special case above); FIXED; TrailDesign.htm: bgcolor within TABLEs not working in Firefox DUE to hex-color w/o nbr-sign; ==CHECK FOR OTHER CASES; 2010-07-05: getting repeated nav-revision on NativeOrchidTour.htm; one unusual feature is having a META-tag; flaw in navX:navF comparing?? most peculiar: after several such spurious nav-revisings, I started looking at why, was baffled; happens again if NativeOrchidTour.htm is "touch"ed; AHA, it's a "dos-file" problem; ie: it contained CR+LF line-endings; have fixed it--!!-- if [[ $F == NativeOrchidTour.htm ]];then echo "==F:NativeOrchidTour.htm"; exit; fi ##==TEMP DEBUG==