6 my $recepies = '/srv/sysadmin-cookbook/recepies';
14 sub html { push @html, @_ }
16 my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
17 my $escape_re = join '|' => keys %escape;
21 my $content = read_file $path;
22 $content =~ s{[\n\r\s]+$}{}s;
23 $content =~ s/($escape_re)/$escape{$1}/gs;
28 find({ follow => 0, no_chdir => 1, wanted => sub {
29 push @names, $_ unless m{/\.};
32 foreach my $path ( sort @names ) {
35 $name =~ s{^$recepies/*}{};
38 html "</ul>" if $in_ul++;
39 html "<h1>$name</h1><ul>";
40 } elsif ( -l $path ) {
41 my $to = readlink $path;
42 html "<li>$name</li>";
44 html "<li>$name<pre>", file( $path ), "</pre></li>";
49 html "</ul>" if $in_ul;
53 <title>Sysadmin Cookbook</title>
55 <link type=text/css rel=stylesheet href="style.css">