From c52cf4953a0c4d579ff639a16eee9aa3371f6c61 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Wed, 10 Nov 2010 02:37:04 +0000 Subject: corrected some bugs with varnames --- webgen | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'webgen') diff --git a/webgen b/webgen index f4a4ec4..24fecd3 100755 --- a/webgen +++ b/webgen @@ -71,19 +71,20 @@ gen_faq() } proc_page() { - _i="$1" - CLEANTPLNAME=$(echo "$_i" | sed 's/^[\-\+\~]//') + _tpl="$1" + CLEANTPLNAME=$(echo "$_tpl" | sed 's/^[\-\+\~]//') OF="$OUT"/"$CLEANTPLNAME""$PAGE_SUFFIX" echo "Compiling $CLEANTPLNAME -> $OF" - SECTIONS=`for _sec in $(grep --no-filename -- "^$_i[^a-zA-Z0-9]" '#section-index'* | sed 's/^[^ \t]*[ \t]*[ \t]//'); do O=''; for i in $(tr . ' ' <<<"$_sec"); do O="$O.$_i"; echo $O; done; done` + SECTIONS=`for _sec in $(grep --no-filename -- "^$_tpl[^a-zA-Z0-9]" '#section-index'* | sed 's/^[^ \t]*[ \t]*[ \t]//'); do O=''; for i in $(tr . ' ' <<<"$_sec"); do O="$O.$i"; echo $O; done; done` +# echo "Sections: $SECTIONS" SECTIONS_REGEX=$(for _sec in $SECTIONS; do echo "s/(section==$_sec:\([^)]*\):)/\1/g;"; done; echo "s/(section==.*:.*:)//g") - MENU=$(grep --no-filename -- "^$_i[^a-zA-Z0-9]" '#menu-index'* | sed 's/^[^ \t]*[ \t]*[ \t]//'); + MENU=$(grep --no-filename -- "^$_tpl[^a-zA-Z0-9]" '#menu-index'* | sed 's/^[^ \t]*[ \t]*[ \t]//'); [ "$MENU" = '' ] && MENU="$DEFAULT_MENU" { cat -- -$HEADER cat -- "$MENU" cat -- -menu-mid - cat -- $_i + cat -- $_tpl [ "$CLEANTPLNAME" = 'FAQ' ] && gen_faq cat -- -$END } | \ -- cgit v1.2.3