From a9264efc5befe47d962238b26470e5163cd40351 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Oct 12 2010 06:51:56 +0000 Subject: Update html_updateHeadings.sh. - Awk allays my one-array frustration :). --- diff --git a/Scripts/Bash/Functions/Html/html_updateHeadings.sh b/Scripts/Bash/Functions/Html/html_updateHeadings.sh index c773215..62fa7f8 100644 --- a/Scripts/Bash/Functions/Html/html_updateHeadings.sh +++ b/Scripts/Bash/Functions/Html/html_updateHeadings.sh @@ -11,7 +11,7 @@ #

Title

# # In the above examples, h1 alternates from h1 to h6. Closing tag -# must be present and match the one opening. The value of and options are the md5sum of page # location, plus the 'head-' string, plus the heading string. If # heading title or page location changes, the values of ' + echo "

`gettext "Table of contents"`

" + for TOCENTRY in "${TOCENTRIES[@]}";do + echo $TOCENTRY + done \ + | awk 'BEGIN {FS=":"} + { + if ($1 == 0 && $2 == $3) { + opentags = "" + } + } + if ($1 > 0 && $2 >= $3 && $3 == 1) { + print "" + print "" + } + if ($1 > 0 && $2 < $3) { + for (i = 1; i <= $2; i++) { + print "" + } + } + print "" + }') + + + # Update file's table of contents. + sed -i -r '/
(.*)<\/div>/c'"$(echo -e $TOC)" $FILE + + # Reset counters. + COUNT=0 + PREVCOUNT=0 done