/[sysadmin-cookbook-html]/bin/html.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/html.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Thu Aug 20 16:47:46 2009 UTC revision 10 by dpavlin, Tue Sep 1 18:00:21 2009 UTC
# Line 8  my $recepies = 'recepies/'; Line 8  my $recepies = 'recepies/';
8    
9  use File::Find;  use File::Find;
10  use File::Slurp;  use File::Slurp;
11    use File::Path;
12  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
13  use XML::Simple;  use XML::Simple;
14  use Regexp::Common qw /URI/;  use Regexp::Common qw /URI/;
# Line 76  sub header { Line 77  sub header {
77  my $to_path = '';  my $to_path = '';
78  our @item;  our @item;
79    
80    sub mkfilepath {
81            my $path = shift;
82            $path =~ s{/[^/]+$}{};
83            mkpath $path unless -d $path;
84    }
85    
86  sub new_feed {  sub new_feed {
87          my $name = shift;          my $name = shift;
88          my $feed = XML::FeedPP::RSS->new();          my $feed = XML::FeedPP::RSS->new();
# Line 95  sub add_item { Line 102  sub add_item {
102    
103          my $item_feed = new_feed( $name );          my $item_feed = new_feed( $name );
104          add_feed_item_description($item_feed, $name, "http://sysadmin-cookbook.rot13.org/#$name", $content);          add_feed_item_description($item_feed, $name, "http://sysadmin-cookbook.rot13.org/#$name", $content);
105          $item_feed->to_file("rss/$name.xml");          my $file = "rss/$name.xml";
106            mkfilepath $file;
107            $item_feed->to_file($file);
108    
109          warn "# $name\n";          warn "# $name\n";
110  }  }
# Line 113  foreach my $path ( sort @names ) { Line 122  foreach my $path ( sort @names ) {
122          next if ( -d $path && ! -e "$path/.svn" );          next if ( -d $path && ! -e "$path/.svn" );
123    
124          my $name = $path;          my $name = $path;
125    #       $name =~ s{^$recepies.*?([^/]+)$}{$1} || next;
126          $name =~ s{^$recepies.*?([^/]+)$}{$1} || next;          $name =~ s{^$recepies.*?([^/]+)$}{$1} || next;
127          next unless $name;  
128            my @just_path = split m{/}, $path;
129            @just_path = splice @just_path, 1, -1;
130    
131          if ( -d $path ) {          if ( -d $path ) {
132                  add_item( splice(@item,0) );                  add_item( splice(@item,0) );
133                  header 1,$name;                  my $h1 = join(' ',@just_path);
134                    $h1 = qq|<span class="p">$h1</span> | if $h1;
135                    $h1 .= $name;
136                    header 1, $h1;
137                  $to_path = '';                  $to_path = '';
138                  push @item, $name;                  push @item, $name;
139          } elsif ( -l $path ) {          } elsif ( -l $path ) {
# Line 152  h1 { Line 167  h1 {
167          padding: 0.3em;          padding: 0.3em;
168  }  }
169    
170    h1 .p {
171            color: #888;
172    }
173    
174  .toc {  .toc {
175          font-size: 80%;          font-size: 80%;
176  }  }

Legend:
Removed from v.9  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26