ref: 11af90dd977234152adb4bc72ae7f438cb80a200
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; } a{ color: white; } div{ float: left; text-align: center; padding: 0.25cm; width: 400px; height: 400px; } img{ width: 320px; height: 320px; } .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>' } cat <<EOF </body> </html> EOF