From: Dobrica Pavlinusic Date: Tue, 1 Sep 2009 18:00:21 +0000 (+0000) Subject: display full path to document part in grey (as breadcrumbs) X-Git-Url: http://git.rot13.org/?p=sysadmin-cookbook-html;a=commitdiff_plain;h=c13b4194deff3dd1b19d73c6a4849649d54dfbc1 display full path to document part in grey (as breadcrumbs) git-svn-id: file:///home/dpavlin/private/svn/sysadmin-cookbook-html@10 3e18072f-9615-4e06-9d3a-648eafba3f8d --- diff --git a/bin/html.pl b/bin/html.pl index 768fce4..35827eb 100755 --- a/bin/html.pl +++ b/bin/html.pl @@ -8,6 +8,7 @@ my $recepies = 'recepies/'; use File::Find; use File::Slurp; +use File::Path; use Data::Dump qw/dump/; use XML::Simple; use Regexp::Common qw /URI/; @@ -76,6 +77,12 @@ sub header { my $to_path = ''; our @item; +sub mkfilepath { + my $path = shift; + $path =~ s{/[^/]+$}{}; + mkpath $path unless -d $path; +} + sub new_feed { my $name = shift; my $feed = XML::FeedPP::RSS->new(); @@ -95,7 +102,9 @@ sub add_item { my $item_feed = new_feed( $name ); add_feed_item_description($item_feed, $name, "http://sysadmin-cookbook.rot13.org/#$name", $content); - $item_feed->to_file("rss/$name.xml"); + my $file = "rss/$name.xml"; + mkfilepath $file; + $item_feed->to_file($file); warn "# $name\n"; } @@ -113,12 +122,18 @@ foreach my $path ( sort @names ) { next if ( -d $path && ! -e "$path/.svn" ); my $name = $path; +# $name =~ s{^$recepies.*?([^/]+)$}{$1} || next; $name =~ s{^$recepies.*?([^/]+)$}{$1} || next; - next unless $name; + + my @just_path = split m{/}, $path; + @just_path = splice @just_path, 1, -1; if ( -d $path ) { add_item( splice(@item,0) ); - header 1,$name; + my $h1 = join(' ',@just_path); + $h1 = qq|$h1 | if $h1; + $h1 .= $name; + header 1, $h1; $to_path = ''; push @item, $name; } elsif ( -l $path ) { @@ -152,6 +167,10 @@ h1 { padding: 0.3em; } +h1 .p { + color: #888; +} + .toc { font-size: 80%; }