ref: b490278c9123db9f9edfc3dd2b324eba39a0794c
dir: /mkyearidx.rc/
#!/bin/rc this=`{basename `{pwd}} months=(January February March April May June July August September October November December) cat <<EOF <!DOCTYPE html> <html> <head> <title>$1</title> <style> body{ background-color: black; text-align: center; } div>p, a{ color: white; } div{ float: left; text-align: center; padding: 0.25cm; width: 200px; height: 200px; } div.bordered{ float: none; display: inline-block; width: 160px; height: 160px; padding: 0px; border: 1px solid white; } img{ width: 160px; height: 160px; } .disabled{ color: grey; } </style> </head> <body> <p> EOF fn findnext{ @{ for(i in `{seq `{echo $1 $2 | bc} $2 $3}){ if(test -d ../^$i){ echo $i exit } } } } prev=`{findnext $this -1 1990} if(~ $#prev 0) echo '<span class="disabled">prev</span>' if not echo '<a href="../'^$"prev^'/index.html">prev</a>' echo ' | <a href="../index.html">up</a> | ' next=`{findnext $this +1 `{date '+%Y'}} if(~ $#next 0) echo '<span class="disabled">next</span>' if not echo '<a href="../'^$next^'/index.html">next</a>' echo '</p>' for(m in `{seq -w 1 12}){ if(test -d $m) echo '<div><a href="'^$m^'/index.html"><img src="'^$m^'/montage.jpg"/><p>'^$months($m)^'</p></a></div>' if not echo '<div><div class="bordered"></div><p>'^$months($m)^'</p></div>' } cat <<EOF </body> </html> EOF