Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

included meta elements to avoid garbage characters

  • Loading branch information...
commit 0b507805f478bf739afabd6a9994f2d49ccc7568 1 parent bda85e8
@Cside Cside authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 webiblo.pl
View
15 webiblo.pl
@@ -102,10 +102,19 @@ sub get_content {
$tree->eof;
if ( $book->{content_xpath} ) {
- my $content = ($tree->findnodes($book->{content_xpath}))[0];
+ my $content = ($tree->findnodes($book->{content_xpath}))[0]->as_XML;
+ my $meta = join '', map { $_->as_XML } $tree->findnodes('//head/meta');
$tree = HTML::TreeBuilder::XPath->new;
- $tree->no_expand_entities(1);
- $tree->parse($content->as_XML);
+ $tree->parse(<<"HTML");
+ <html>
+ <head>
+ $meta
+ </head>
+ <body>
+ $content
+ </body>
+ </html>
+HTML
$tree->eof;
}
Please sign in to comment.
Something went wrong with that request. Please try again.