shift or die

security. photography. foobar.

Images in Angerwhale

While looking for a blog software that was written in Perl, I stumpled upon Angerwhale. I liked its feature list and about 50 dependencies later, I had a running test server on my notebook. But of course I had something to complain about, too. When trying to post an image (no, nothing fancy, just a simple <img> tag), it seemed to be filtered out. As I might want to post the odd photo sometimes, this was something I was not particularly happy about ...

Luckily, #angerwhale at irc.perl.org came to rescue. Ash of perlitist.com mentioned that he had hacked the HTML formatter to achieve exactly the same thing. So here is the quick'n'dirty patch for those who want to post images, too:

--- HTML.pm.old 2007-02-19 18:18:16.000000000 +0100
+++ HTML.pm.new 2007-02-19 18:19:51.000000000 +0100
@@ -294,10 +294,7 @@
 
             # image
             elsif ( $type eq 'img' ) {
-                my $alt = $element->attr('alt');
-                if ($alt) {
-                    $result .= "<p>[$alt]</p>";
-                }
+                $result .= $element->as_XML;
             }
 
             # heading