Skip to content
Browse files

Quit separate getting image to a function and rewrite image path in H…

…TML file for handling correctly images with kindlegen
  • Loading branch information...
1 parent 34d05af commit 192b031efef8101d3671b8b28c713da84e13643f @mizzy committed Jan 14, 2012
Showing with 6 additions and 8 deletions.
  1. +6 −8 webiblo.pl
View
14 webiblo.pl
@@ -116,7 +116,12 @@ sub get_content {
for my $image ( @images ) {
my $base = $uri->as_string;
$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$/;
@@ -129,10 +134,3 @@ sub get_content {
$file .= "#$fragment" if $fragment;
$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.
Something went wrong with that request. Please try again.