#!/usr/bin/perl #+JMJ # gentncmap - Generate totallynuclear.club site map # 2014 David Meyer <papa@sdf.org> open INF, "/bin/find /home -name '*.html' -o -name '*.txt' 2>/dev/null|grep '/public_html/'|"; open OUTF, ">/home/papa/public_html/tncmap.html"; print OUTF <<EOT; <html> <head> <title>tncmap</title> <link rel="stylesheet" type="text/css" href="css/fordphosphor.css"> </head> <body> <h1>tncmap</h1> <p id="nav1"><a href="/"><em>totallynuclear.club</em></a> / <a href="/~papa"><em>~papa</em></a></p> <p id="tagline">totallynuclear.club site map</p> <p><a href="projects.html">projects</a> <a href="tildeverse.html">tildeverse</a> <a href="css/index.html">css</a> <a href="about.html">about</a> <a href="contact.html">contact</a></p> <hr> <table id="tncmap"> EOT $prevuser = $prevdir = ""; while (<INF>) { print OUTF "<tr>"; chop $_; @comp = split '/', substr $_, 1; $user = $comp[1]; if ($#comp > 3) {$dir = join '/', @comp[3..$#comp-1];} else {$dir = "";} $file = $comp[$#comp]; if ($user ne $prevuser) { print OUTF "<td><a href='/~$user'>~$user</a></td>"; $prevuser = $user; $prevdir = ""; } else { print OUTF "<td></td>"; } if ($dir ne $prevdir) { print OUTF "<td><a href='/~$user/$dir'>$dir</a></td>"; $prevdir = $dir; } else { print OUTF "<td></td>"; } print OUTF "<td><a href='/~$user/$dir/$file'>$file</a></td></tr>\n"; } print OUTF <<EOT; </table> <p><a href="mailto:papa+totallynuclear\@sdf.org?subject=tncmap">Send comment</a> (via e-mail)</p> <hr> </body> </html> EOT close INF; close OUTF;