]> ruin.nu Git - ndwebbie.git/commitdiff
output original text, if it can't be parsed
authorMichael Andreen <harv@ruin.nu>
Wed, 17 Jan 2007 09:55:37 +0000 (09:55 +0000)
committerMichael Andreen <harv@ruin.nu>
Wed, 17 Jan 2007 09:55:37 +0000 (09:55 +0000)
ND/Web/Include.pm

index 220a7819a6b772beb7ffaeeded7fb7f04032fe4e..bdeb350f58a7f8a48945226a84fe8a0f49c48995 100644 (file)
@@ -19,7 +19,7 @@
 
 package ND::Web::Include;
 use strict;
-use warnings FATAL => 'all';
+use warnings;
 use CGI qw{:standard};
 require Exporter;
 use BBCode::Parser;
@@ -72,9 +72,11 @@ sub parseMarkup {
        #$text =~ s{\[PRE\](.*?)\[/PRE\]}{<pre>$1</pre>}sgi;
        #$1 =~ s{<br/>}{}g;
 
-       my $tree = BBCode::Parser->DEFAULT->parse($text);
-
-       return scalar $tree->bodyHTML;;
+       eval{
+               my $tree = BBCode::Parser->DEFAULT->parse($text);
+               $text = $tree->toHTML;
+       };
+       return $text;
 }