an improvement
This commit is contained in:
parent
16359e2054
commit
b90b3d6f4d
@ -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<A HREF=\"$f\">\></A>,g" \
|
||||
&& nav="<A HREF=\"$last\">\<</A>" \
|
||||
&& sed -i "./blah/$last.html" \
|
||||
-e "s,\$!NAVIGATION,$nav<A HREF=\"$f.html\">\></A>,g" \
|
||||
&& nav="<A HREF=\"$last.html\">\<</A>" \
|
||||
|| true
|
||||
nav="$nav<A HREF=\"index.html\">^</A>"
|
||||
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' \
|
||||
|
Loading…
Reference in New Issue
Block a user