From: Marius Gavrilescu Date: Sat, 11 Apr 2015 11:57:02 +0000 (+0300) Subject: Parse and reserialize literal HTML X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=17a063860b499a0fcf7b70c6f37b00d3a6ffb0d2;hp=a7e836f27d8959ad676632e859f7e9ad79595de8;p=gruntmaster-page.git Parse and reserialize literal HTML --- diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index ebbc145..3cfbc54 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -10,7 +10,12 @@ use POSIX qw//; 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) = @_;