Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created October 26, 2009 10:04
Show Gist options
  • Save kyanny/218540 to your computer and use it in GitHub Desktop.
Save kyanny/218540 to your computer and use it in GitHub Desktop.
implicit() implicit_tags()
#!/usr/bin/env perl
use strict;
use HTML::TreeBuilder;
use Test::Base;
plan tests => 1 * blocks;
run_is input => 'expected';
sub html_tree_parse {
my $tree = HTML::TreeBuilder->new();
$tree->implicit(0); # これはちょっと違う気がする
$tree->implicit_tags(0); # これを false にすればいいんだと思うんだがなぁ...
$tree->parse($_);
$tree->eof();
return $tree->as_HTML('');
}
__END__
===
--- input html_tree_parse
<div>
<p>foo bar baz</p>
<div class="blah">
<p>blah blah blah</p>
</div>
</div>
--- expected
<div><p>foo bar baz<div class="blah"><p>blah blah blah</div></div>
--- LAST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment