Skip to content

Commit

Permalink
Get css files and use this files instead of default style of webiblo.
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed Jan 14, 2012
1 parent 3f20037 commit 9f5dc4f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions webiblo.pl
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 9f5dc4f

Please sign in to comment.