Skip to content

Commit

Permalink
Quit separate getting image to a function and rewrite image path in H…
Browse files Browse the repository at this point in the history
…TML file for handling correctly images with kindlegen
  • Loading branch information
mizzy committed Jan 13, 2012
1 parent 34d05af commit 192b031
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions webiblo.pl
Expand Up @@ -116,7 +116,12 @@ sub get_content {
for my $image ( @images ) { for my $image ( @images ) {
my $base = $uri->as_string; my $base = $uri->as_string;
$base =~ s{/[^/]+$}{}; $base =~ s{/[^/]+$}{};
get_image(URI->new("$base/" . $image->attr('src')));
warn "Getting $uri ...\n";
my $uri = URI->new("$base/" . $image->attr('src'));
my $file = ($uri->path_segments)[-1];
mirror($uri, "out/$file") unless -f "out/$file";
$image->attr('src', $file);
} }


$file =~ s/\..+/.html/ unless $file =~ /\.html$/; $file =~ s/\..+/.html/ unless $file =~ /\.html$/;
Expand All @@ -129,10 +134,3 @@ sub get_content {
$file .= "#$fragment" if $fragment; $file .= "#$fragment" if $fragment;
$object->{href} = $file; $object->{href} = $file;
} }

sub get_image {
my $uri = shift;
warn "Getting $uri ...\n";
my $file = ($uri->path_segments)[-1];
mirror($uri, "out/$file") unless -f "out/$file";
}

0 comments on commit 192b031

Please sign in to comment.