ref: 14c50ed0b3050906015c48c987460865bfd7f30c
dir: /mkpages.rc/
#!/bin/rc yflag=() while(~ $1 -*){ switch($1){ case -y yflag=1 } } 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>' if(~ $yflag 1) echo ' | <a href="../../'^$year^/^$month^'/index.html">'^$year^/^$month^'</a> | ' if not echo ' | <a href=".">up</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