ref: 743c38b176b1e9ce68d07a4e65d5d04ce5d29e8f
dir: /mkalbumindex.rc/
#!/bin/rc this=`{basename `{pwd}} year=`{basename `{dirname `{pwd}}} cat <<EOF <!DOCTYPE html> <html> <head> <style> body{ background-color: black; text-align: center; } img{ height: 96px; } a{ color: white; } .disabled{ color: grey; } </style> </head> <body> <p> EOF fn findnext1{ for(i in `{seq $2 $3 $4 | sed 's/^.$/0&/'}){ if(test -d ../../$1/^$i){ echo $1/$i exit } } } fn findnext{ @{ findnext1 $1 `{echo $2 $3 | bc} $3 $4 end=1990 ms=12 me=1 if(~ $3 +1){ end=`{date '+%Y'} ms=1 me=12 } for(y in `{seq `{echo $1 $3 | bc} $3 $end}){ if(test -d ../../^$y) findnext1 $y $ms $3 $me } } } prev=`{findnext $year $this -1 1} if(~ $#prev 0) echo '<span class="disabled">prev</span>' if not echo '<a href="../../'^$"prev^'/index.html">prev</a>' echo ' | <a href="../index.html">'^$year^'</a> | ' next=`{findnext $year $this +1 12} if(~ $#next 0) echo '<span class="disabled">next</span>' if not echo '<a href="../../'^$next^'/index.html">next</a>' echo '</p>' ls *.thumb.JPG | awk '{ printf "<a href=\"%d.html\"><img src=\"%s\"/></a>\n", NR, $0 }' cat <<EOF </body> </html> EOF