Permalink
Browse files

Get css files and use this files instead of default style of webiblo.

  • Loading branch information...
1 parent 3f20037 commit 9f5dc4f32a53fc03ff61feec6ee9fc5f2d531ee2 @mizzy committed Jan 14, 2012
Showing with 14 additions and 3 deletions.
  1. +14 −3 webiblo.pl
View
17 webiblo.pl
@@ -116,10 +116,21 @@ sub get_content {
}
}
- my $head = ($tree->findnodes('/html/head'))[0];
- $head->push_content($style);
+ my @links = $tree->findnodes('//link[@rel="stylesheet"]');
+ for my $link ( @links ) {
+ warn "Getting $uri ...\n";
+ my $href = $link->attr('href');
+ my $base = $uri->as_string;
+ $base =~ s{/[^/]+$}{};
+ $href = "$base/$href" if $href !~ m!^https?://!;
+ my $file = (URI->new($href)->path_segments)[-1];
+ mirror($href, "out/$file") unless -f "out/$file";
+ }
- ## TODO: Get CSS file
+ if ( ! scalar @links ) {
+ my $head = ($tree->findnodes('/html/head'))[0];
+ $head->push_content($style)
+ };
my @images = $tree->findnodes('//img');
for my $image ( @images ) {

0 comments on commit 9f5dc4f

Please sign in to comment.