]> iEval git - plack-app-gruntmaster.git/commitdiff
Parse and reserialize literal HTML
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 11 Apr 2015 11:57:02 +0000 (14:57 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 11 Apr 2015 11:57:02 +0000 (14:57 +0300)
lib/Plack/App/Gruntmaster/HTML.pm

index ebbc145e22cd3bd9f328c3e3a8da27b749d9e9c8..3cfbc54be43acb876d8bce726fc61b442ece0d1b 100644 (file)
@@ -10,7 +10,12 @@ use POSIX qw//;
 use Data::Dumper qw/Dumper/;
 
 sub ftime ($)   { POSIX::strftime '%c', localtime shift }
 use Data::Dumper qw/Dumper/;
 
 sub ftime ($)   { POSIX::strftime '%c', localtime shift }
-sub literal ($) { HTML::Element::Library::super_literal shift // '' }
+sub literal ($) {
+       my $b = HTML::TreeBuilder->new;
+       $b->ignore_unknown(0);
+       $b->parse(shift // '');
+       HTML::Element::Library::super_literal $b->guts->as_HTML;
+}
 
 sub HTML::Element::edit_href {
        my ($self, $sub) = @_;
 
 sub HTML::Element::edit_href {
        my ($self, $sub) = @_;
This page took 0.027557 seconds and 4 git commands to generate.