diff --git a/homepage/homepage.local b/homepage/homepage.local index 7f5fd63..8de787e 100755 --- a/homepage/homepage.local +++ b/homepage/homepage.local @@ -4,16 +4,30 @@ set -x for f in ./blah/*.html do - f="$(printf '%s\n' "$f" | sed 's,./blah/,,')" + cat "$f" + awk ' +BEGIN { n = 0; } +/^\$!NAVIGATION$/ { + if(++n == 1){ + print $0 "\n\n" substr(FILENAME, 8, 10) "\n" + }else + print "\n" $0; +} +!/^\$!NAVIGATION$/ { print $0 } +' "$f" >"$f.tmp" \ + && mv "$f.tmp" "$f" \ + || rm "$f.tmp" + f="$(printf '%s\n' "$f" | sed -e 's,./blah/,,' -e 's,\.html$,,')" + sed -i "./blah/$f.html" -e 's_\$!NAVIGATION_&\n'"$f"'\n_1' test -n "$last" \ - && sed -i "./blah/$last" \ - -e "s,\$!NAVIGATION,$nav\>,g" \ - && nav="\<" \ + && sed -i "./blah/$last.html" \ + -e "s,\$!NAVIGATION,$nav\>,g" \ + && nav="\<" \ || true nav="$nav^" last="$f" done -sed -i "s,\$!NAVIGATION,$nav,g" "./blah/$last" +sed -i "s,\$!NAVIGATION,$nav,g" "./blah/$last.html" ls ./blah/*.html \ | sed -e 's_.*/__g' \