ref: 50ecfbf8be4239707f7fe9a1be61e40d303951b7
dir: /mkpages.rc/
#!/bin/rc month=`{basename `{pwd}} year=`{basename `{dirname `{pwd}}} fn mkpage{ echo '<!DOCTYPE html> <html> <head> <style> body{ background-color: black; text-align: center; } a{ color: white; } .disabled{ color: grey; } </style> </head> <body> <p>' if(! ~ $3 '') echo '<a href="'^$3^'.html">prev</a>' if not echo '<span class="disabled">prev</span>' echo ' | <a href="../../'^$year^/^$month^'/index.html">'^$year^/^$month^'</a> | ' if(! ~ $4 '') echo '<a href="'^$4^'.html">next</a>' if not echo '<span class="disabled">next</span>' echo '</p> <p><a href="'^$2^'"><img src="'^$1^'"/></a></p> </body> </html>' } ls *.full.* | sed 's/\.full\.[A-Z]\+$//' | awk '{ if (buf){ i = NR - 1 p = i - 1 if(p < 1) p = "" n = i + 1 printf "mkpage %s.big.JPG %s.full.* ''%s'' ''%s'' >%d.html\n", buf, buf, p, n, i } buf = $0 } END{ i = NR p = i - 1 printf "mkpage %s.big.JPG %s.full.* ''%s'' '''' >%d.html\n", buf, buf, p, i }' | rc