use local checkout
[sysadmin-cookbook-html] / bin / html.pl
index fcaeb34..6039b36 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
 use warnings;
 use strict;
 
-my $recepies = '/srv/sysadmin-cookbook/recepies';
+my $recepies = 'recepies/';
 
 use File::Find;
 use File::Slurp;
 
 use File::Find;
 use File::Slurp;
@@ -30,10 +30,11 @@ sub file {
        my $changes = join("\n",
                map {
                        my $d = $_->{date};
        my $changes = join("\n",
                map {
                        my $d = $_->{date};
-                       $d =~ s{\.\d+Z}{};
+                       $d =~ s{:\d\d\.\d+Z}{};
                        $d =~ s{T}{ };
                        $d =~ s{T}{ };
-                       qq|<li>$_->{msg} <span class="date">$d</span></li>|
-               } @{ $log->{logentry} }
+                       my $r = $_->{revision};
+                       qq|<li>$_->{msg} <a class="date" title="r$r" href="http://svn.rot13.org/index.cgi/sysadmin-cookbook/revision?rev=$r">$d</a></li>|
+               } reverse @{ $log->{logentry} }
        );
 
        $path =~ s{^$recepies/*(.*?[^/]+)$}{$1} || next;
        );
 
        $path =~ s{^$recepies/*(.*?[^/]+)$}{$1} || next;
@@ -46,7 +47,7 @@ sub file {
 
 my @names;
 find({ follow => 0, no_chdir => 1, wanted => sub {
 
 my @names;
 find({ follow => 0, no_chdir => 1, wanted => sub {
-       push @names, $_ unless m{/\.};
+       push @names, $_ unless m{/\.} || m{^\.};
 }}, $recepies );
 
 my $last_level = 0;
 }}, $recepies );
 
 my $last_level = 0;
@@ -74,6 +75,8 @@ my $to_path = '';
 
 foreach my $path ( sort @names ) {
 
 
 foreach my $path ( sort @names ) {
 
+       next if ( -d $path && ! -e "$path/.svn" );
+
        my $name = $path;
        $name =~ s{^$recepies.*?([^/]+)$}{$1} || next;
        next unless $name;
        my $name = $path;
        $name =~ s{^$recepies.*?([^/]+)$}{$1} || next;
        next unless $name;
@@ -117,7 +120,8 @@ pre.changes {
 }
 
 pre.content {
 }
 
 pre.content {
-       padding: 1em;
+       padding: 0.5em;
+       margin: 1em;
        background: #eee;
 }
 
        background: #eee;
 }
 
@@ -125,10 +129,15 @@ li .date {
        font-family: monospace;
        color: #888;
        float: right;
        font-family: monospace;
        color: #888;
        float: right;
+       margin-right: 1em;
 }
 
 </style>
 </head><body>
 }
 
 </style>
 </head><body>
+       <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/hr/"><img alt="Creative Commons License" style="border-width:0; float: right" src="http://i.creativecommons.org/l/by-nc-sa/3.0/hr/88x31.png" /></a>
+       <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Sysadmin Cookbook</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.rot13.org/~dpavlin/" property="cc:attributionName" rel="cc:attributionURL">Dobrica Pavlinusic</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/hr/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Croatia License</a>.
+       <br />
+       <small><a href="http://svn.rot13.org/index.cgi/sysadmin-cookbook/">Source code repository</a></small>
        |
        . "<div class=toc>$toc_html</div>"
        , join("\n", @html)
        |
        . "<div class=toc>$toc_html</div>"
        , join("\n", @html)