]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/htmlbalance.pm
htmlbalance: don't compact whitespace, and set misc other options
[git.ikiwiki.info.git] / IkiWiki / Plugin / htmlbalance.pm
index 3a2d62d15d47feb20886b594a51d3bc231e62a1b..dcd92055fbebcdeefdbf07d45337e7f0b2f9e360 100644 (file)
@@ -30,7 +30,15 @@ sub sanitize (@) { #{{{
        my %params=@_;
        my $ret = '';
 
        my %params=@_;
        my $ret = '';
 
-       my $tree = HTML::TreeBuilder->new_from_content($params{content});
+       my $tree = HTML::TreeBuilder->new();
+       $tree->ignore_unknown(0);
+       $tree->ignore_ignorable_whitespace(0);
+       $tree->no_space_compacting(1);
+       $tree->p_strict(1);
+       $tree->store_comments(0);
+       $tree->store_declarations(0);
+       $tree->store_pis(0);
+       $tree->parse_content($params{content});
        my @nodes = $tree->disembowel();
        foreach my $node (@nodes) {
                if (ref $node) {
        my @nodes = $tree->disembowel();
        foreach my $node (@nodes) {
                if (ref $node) {