Permalink
Browse files

turn =Image into <img />

  • Loading branch information...
1 parent a372b5d commit ecd7cf3184a6f39851499e56b7506e439d14e756 @moritz moritz committed Aug 6, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/Pod/To/HTML.pm
View
@@ -228,6 +228,22 @@ multi sub node2html(Pod::Block::Named $node) returns Str {
return node2html($node.content[0]) ~ "\n"
~ node2html($node.content[1..*-1]);
}
+ when 'Image' {
+ my $url;
+ if $node.content == 1 {
+ my $n = $node.content[0];
+ if $n ~~ Str {
+ $url = $n;
+ }
+ elsif ($n ~~ Pod::Block::Para) && $n.content == 1 {
+ $url = $n.content[0] if $n.content[0] ~~ Str;
+ }
+ }
+ unless $url.defined {
+ die "Found an Image block, but don't know how to extract the image URL :(";
+ }
+ return qq[<img src="$url" />];
+ }
default {
if $node.name eq 'TITLE' {
$title = node2text($node.content);

0 comments on commit ecd7cf3

Please sign in to comment.