Re: Tidy bug

Ger Hobbelt <[email protected]> Sat, 21 Nov 2009 05:44:09 +0100
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
Okay,

created a few testcases and pulled them through tidy as it is (CVS
head) - this was/is the final stage for some other edits in there, but
this #2900790 could be poked at the same time.

One testcase is a straight copy of your example as filed with the
bugtracker; the second one is a slightly edited one: the <tr><tr> in
there is placed /after/ the </table> instead of before <table>. Wanted
to see what tidy did to both, particularly the last one.

Turns out the last on produces two tables, which in my book is very okay.
Which, however, has me backpedaling on my original order of preference
for the leading case (#2900790): for the tool to be truly consistent
it should wrap it in a separate table, just like it did to the
trailing <tr><tr>. This would be internally consistent behaviour for
tidy when encountering such buggy markup; yes, I initially thought it
would be nice to mimic common browser behaviour to a tee, but now,
looking at this output again, there's this thought: tidy is a cleanup
tool; if the input has faults like that, either done by hand or by
machine (I've seen some crappy HTML code generators in my time :-(( ),
then such should be visible. And at the very least, it should be
consistent behaviour throughout the input, irrespective whether such a
<tr>...</tr> leads or trails a correct <table>..</table>

If this last line of thought is agreeable to y'all, I'll check whether
I can concoct a suitable patch for this one.

Ger





On Thu, Nov 19, 2009 at 11:50 PM, Ben McCann <[email protected]> wrote:
> I filed a bug with the details of this problem. =A0Not sure if anyone has=
 time
> to address it, but it'd be great if so. =A0jtidy won't accept a patch unt=
il
> it's fixed here and I'm not much of a C coder.
> Thanks!
> Ben
>
>
> On Tue, Nov 10, 2009 at 1:13 PM, Ben McCann <[email protected]> wrote:
>>
>> I'd also vote for #2 given that I think there are big advantages to
>> matching what the major browsers do.
>>
>> On Mon, Nov 9, 2009 at 6:58 AM, Ger Hobbelt <[email protected]> wrote:
>>>
>>> On Sun, Nov 8, 2009 at 8:05 PM, Klaus Johannes Rusch
>>> <[email protected]> wrote:
>>> > For this specific example, moving the <tr> into the table (and the
>>> > tbody)
>>> > would seem a better solution, not sure we can generalize this though.
>>> > The
>>> > dangling tr could be handled in four ways:
>>> >
>>> [...]
>>> > 2. Discard the tr element and keep the content (this is the behaviour
>>> > of IE7
>>> > and Firefox 3, good for a browser, maybe good for tidy?)
>>> > 3. Surround the tr element with a new table (would address the issue
>>> > below
>>> > but we may end up with lots of tablen when there is a missing table
>>> > element
>>> > and multiple trs)
>>>
>>> Preferably #2. Reason: when applying htmltidy to content which
>>> contains such markup errors, it will thus perform a cleanup which will
>>> change the 'look' of the output only negligibly (or not at all) when
>>> both versions are viewed in browsers - and that's where most of us
>>> eyeball HTML anyway.
>>> If not #2, then #3, so that is stays apart from the other chunks of
>>> content and is, as such, still somewhat identifiable as the part where
>>> the original input contained a markup error.
>>>
>>> For trailing <tr> sections, i.e. <tr>s immediately following a
>>> </table> I can see why one would want to merge it in with the table
>>> above (#4); here it about leading <tr> before a <table> and that is a
>>> markup error of same or higher severity IMHO and should be treated as
>>> such, so #4 is lowest on the list of 'good' choices.
>>>
>>> Discarding content (#1) should be prevented when possible, so please
>>> don't pick #1. (Putting at <table> around it is way more informative
>>> and educational to the one who screwed up the markup like that, either
>>> by hand or through generator code, than plonking content chunks to
>>> /dev/null )
>>>
>>> --
>>> Met vriendelijke groeten / Best regards,
>>>
>>> Ger Hobbelt
>>>
>>> --------------------------------------------------
>>> web: =A0 =A0http://www.hobbelt.com/
>>> =A0 =A0 =A0 =A0http://www.hebbut.net/
>>> mail: =A0 [email protected]
>>> mobile: +31-6-11 120 978
>>> --------------------------------------------------
>>>
>>>
>>> -----------------------------------------------------------------------=
-------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and
>>> focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now. =A0http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Tidy-develop mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/tidy-develop
>>
>
>



-- =

Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   [email protected]
mobile: +31-6-11 120 978
--------------------------------------------------

---------------------------------------------------------------------------=
---
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day =

trial. Simplify your report design, integration and deployment - and focus =
on =

what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july