1
0

redundant

This commit is contained in:
dtb 2023-08-06 17:16:50 -04:00
parent 4a2c068ec0
commit 0a8f5f504d

View File

@ -1,53 +0,0 @@
#!/bin/sh
set -x
for f in ./blah/*.html
do
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$,,')"
test -n "$last" \
&& sed -i "./blah/$last.html" \
-e "s,\$!NAVIGATION,$nav<A HREF=\"$f.html\">\&gt;</A>,g" \
&& nav="<A HREF=\"$last.html\">\&lt;</A>" \
|| true
nav="$nav<A HREF=\"index.html\">^</A>"
last="$f"
done
sed -i "s,\$!NAVIGATION,$nav,g" "./blah/$last.html"
ls ./blah/*.html \
| sed -e 's_.*/__g' \
-e 's/\.html$//g' \
| sort -r \
| tee ./feed.xml \
| sed -e 's_.*_<A HREF="/blah/&.html">&</A>_g' \
-e "1i\
<!DOCTYPE html><HEAD><TITLE>blah</TITLE></HEAD>\
<BODY><PRE><A HREF=\"..\">..</A>" \
-e '$a</PRE></BODY></HTML>' \
>./blah/index.html
sed -i feed.xml \
-e "1i\
<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\">\
<channel><title>trinity.moe/blah</title><link>https://trinity.moe/blah</link>\
<lastBuildDate>$(date)</lastBuildDate>" \
-e "s,^....-..-..\$,<item>\
<title>&</title>\
<link>https://trinity.moe/blah/&.html</link>\
<description>blah post for &</description>\
<pubdate>&</pubdate></item>," \
-e '$a</channel></rss>'