Skip Menu |
 

This queue is for tickets about the HTML-Tree CPAN distribution.

Report information
The Basics
Id: 18281
Status: resolved
Priority: 0/
Queue: HTML-Tree

People
Owner: Nobody in particular
Requestors: ashley [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: HTML::TreeBuilder with implicit_body_p_tag() on <br />
Download (untitled) / with headers
text/plain 775b
use HTML::TreeBuilder; my $html = "<br />"; my $root = HTML::TreeBuilder->new(); $root->implicit_body_p_tag(1); $root->xml_mode(1); $root->parse($html); $root->eof(); print $root->as_HTML(), "\n"; ---- Output: "<html><head></head><body><p><br /></body></html>" Desired: "<html><head></head><body><br /></body></html>" Note: this only crops up with the combination of xml_mode and implicit_body_p_tag. I don't think it should place implicit paras around a <br />. I'm trying to write an auto-enpara script. I'm breaking user submissions on ~ \n\n and then treebuilding each block to either auto-enpara, leave alone if it's already a block, or do more parsing. A naked <br />, I think, should not get a para. Thank you for considering it -- all you guys rule. -Ashley
Download (untitled) / with headers
text/plain 579b
On Wed Mar 22 02:30:44 2006, guest wrote: Show quoted text
> I don't think it should place implicit paras around a <br />.
The HTML spec states that BR is an "inline" or "text-level" element; as such, it's defined as a "phrasal" element in HTML::Tagset, which is what HTML::TreeBuilder uses to determine what to wrap a <p> around. The spec is at http://www.w3.org/TR/html401/sgml/dtd.html Since that's the case, <br> gets a <p>, or else a special case would have to be implemented, which I'm loathe to do. Marking as REJECTED, since this is something I'm not willing to change at the moment.
From: ASHLEY [...] cpan.org
Upon reflection I tend to agree. Thanks for looking at it, though. -Ashley


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.