1
0

an improvement

This commit is contained in:
dtb 2023-08-06 16:06:04 -04:00
parent 16359e2054
commit b90b3d6f4d

View File

@ -4,16 +4,30 @@ set -x
for f in ./blah/*.html for f in ./blah/*.html
do 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" \ test -n "$last" \
&& sed -i "./blah/$last" \ && sed -i "./blah/$last.html" \
-e "s,\$!NAVIGATION,$nav<A HREF=\"$f\">\&gt;</A>,g" \ -e "s,\$!NAVIGATION,$nav<A HREF=\"$f.html\">\&gt;</A>,g" \
&& nav="<A HREF=\"$last\">\&lt;</A>" \ && nav="<A HREF=\"$last.html\">\&lt;</A>" \
|| true || true
nav="$nav<A HREF=\"index.html\">^</A>" nav="$nav<A HREF=\"index.html\">^</A>"
last="$f" last="$f"
done done
sed -i "s,\$!NAVIGATION,$nav,g" "./blah/$last" sed -i "s,\$!NAVIGATION,$nav,g" "./blah/$last.html"
ls ./blah/*.html \ ls ./blah/*.html \
| sed -e 's_.*/__g' \ | sed -e 's_.*/__g' \