Re: Tidy [Inferred Table] Bug

Ben McCann <[email protected]> Mon, 4 Jan 2010 16:15:41 -0800
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
--===============4702675936980665388==
Content-Type: multipart/alternative; boundary=000e0cd13b62fcfe48047c5fbc1b

--000e0cd13b62fcfe48047c5fbc1b
Content-Type: text/plain; charset=ISO-8859-1

I thought I'd check up and see if any progress has been made in stopping
Tidy from adding spurious table tags.  I'd love to be able to port a change
over to jtidy once something is checked into tidy.  Hope everyone had a good
holiday!

Thanks,
Ben


On Tue, Nov 24, 2009 at 4:04 PM, Ben McCann <[email protected]> wrote:

> Ah, I see.  That's quite different than what I've always used Tidy for.  I
> never use it to cleanup HTML before serving it.  But rather use it to
> cleanup HTML that I feed to some automated process, in which case I
> generally like it acting the same as the browser because I want the machines
> to interpret it in the same way a person would.  I very frequently will use
> it in unit tests to then be able to run xpath queries on the document and
> assert that certain data is present.  I also frequently use it for data
> extraction tasks along the lines of screen scraping (e.g. I once had a
> consulting client who wanted me to migrate a web app from his proprietary
> app to WordPress.  The DB schema was a mess, so I just wrote a screen
> scraper to take all the data from the rendered page and put it into the
> WordPress DB.)
>
>
> On Tue, Nov 24, 2009 at 7:23 AM, Charlie Reitzel <[email protected]> wrote:
>
>> Hi Ger,
>>
>> I have been following this thread only in a general sense.  But it looks
>> like you all are on a good track.  Keep it going!
>>
>> I also take your point about browser rendering.  As it happens, I have
>> always used Tidy pretty much as you do.    Personally, mod_tidy seems like
>> not such a great idea.  Tidy was never so good at what it does that a
>> person shouldn't clean up after it sometimes.  I always applied it at the
>> front end.  I.e. When content is submitted to a CMS, not at display time.
>>
>> That said, for better or worse, browser rendering is actually the official
>> reference.
>>
>> Way back, when we first started the project, discussions for alternative
>> "edits" would come up again and again.  It did become a more or less
>> official guideline to preserve the browser rendering to the degree
>> possible.  This is an application of the "minimize surprises" design
>> principle.  It is also a tribute to the sometimes heroic lengths browsers
>> will go to make a document readable (and mimic each others' bugs back in
>> the 3.x/4.x era).
>>
>> Browsers do not always render (even good) markup the same way or (for
>> truly
>> bad markup) in an intelligible way.  In which case, choose   the rendering
>> you prefer among the available, intelligible choices.
>>
>> It sounds like this is actually where you are with things.   I.e. are we
>> dealing with markup that produces a wacky layout?
>>
>> Fwiw, I think Dave R.'s original idea is that folks just forget the outer
>> <table> tag sometimes.  <tr> tags too.   So, if you encounter a naked
>> <TD>,
>> give it some clothing.  I don't think he had thought through the cases you
>> are addressing now, which are more ambitious.
>>
>> Charlie
>>
>> At 05:43 AM 11/24/2009 +0100, Ger Hobbelt wrote:
>> >On Mon, Nov 23, 2009 at 4:58 PM, Christopher Woods <[email protected]
>> >
>> >wrote:
>> > > Are you sure that the browsers are actually turning the <tr> content
>> > before the table into a table?
>> >
>> >AFAICT they don't, but then browser rendering isn't exactly the
>> >epitome of reference for deciding what to do with shoddy html IMHO.
>> >
>> >May sound odd, but I don't use tidy to 'keep it looking exactly the
>> >same' in browsers; I use it as a, by now instinctive, part of my
>> >editorial workflow to ensure the servers get fed reasonably well
>> >formed HTML while I might have been doing sleight of hand in the
>> >manual edit process. In which case wrapping a <table> around those
>> ><tr>s is particularly desirable as my hands might have forgotten my
>> >brain wanted it in there - it happens that I sometimes outthink my
>> >typing so words get lost midway.
>> >
>> >In other words: tidy sits in an early position in the editorial
>> >workflow chain with me, not as a slapped-on webserver 'afterthought'
>> >where [generated] crud is compressed into W3C standards adherence,
>> >while required to keep the 'intended look an feel'. mod_tidy et al are
>> >nice, but there are some days where I think a crossbow with serrated
>> >edge bolts is a far better solution to the problems mod_tidy and
>> >friends is expected to solve.
>> >
>> >Never mind that bit of early morning temper, the current state of
>> >affairs ditches the <tr> if it doesn't come with <td>s as well, so it
>> >discards 'completely misplaced <tr>s' shall we say? At least it does
>> >now for several of my test cases, which is desirable behaviour, at
>> >least to me. [Testcases in+out to be posted later; I still suspect the
>> >code from hiding a couple of nasties from me]
>> >
>> > >
>> > > If I remember correctly, when I did some tests on this back in Feb
>> 2006
>> > the browsers just basically stripped the <tr> (or maybe I only had
>> > checked <td>) before any table away and discarded it.  I put in a
>> feature
>> > request to add a new option to disable Tidy's "inferred table"
>> functionality:
>> > >
>> > >
>> >
>> https://sourceforge.net/tracker/?func=detail&aid=1429519&group_id=27659&atid=390966
>> > >
>> > > It's a bit dated now as the request was filed in late Feb 2006 but I
>> > did note which versions of the code the diffs were created from.  You
>> > *might* want to check this and see if the behavior is visually more
>> consistent.
>> > >
>> > > -Chris
>> >
>> >Hadn't checked that one, but will do, certainly. I think I'm much
>> >closer to your original intent now than I was when I wrote that
>> >message you responded to (and I was trying to be lazy about
>> >implementing functionality), but there are still cases where inferred
>> >tables have merit: when everything but the <table> is missing, I'd
>> >like to see them happen. Otherwise, completely shot <tr> sections
>> >would probably be best served without the <tr> at all. Trying to
>> >accomplish that [ballet] splits now. ;-)
>> >
>> >
>> >--
>> >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
>> >_______________________________________________
>> >Tidy-develop mailing list
>> >[email protected]
>> >https://lists.sourceforge.net/lists/listinfo/tidy-develop
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>> _______________________________________________
>> Tidy-develop mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/tidy-develop
>>
>
>

--000e0cd13b62fcfe48047c5fbc1b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>I thought I&#39;d check up and see if any progress has been made in st=
opping Tidy from adding spurious table tags. =A0I&#39;d love to be able to =
port a change over to jtidy once something is checked into tidy. =A0Hope ev=
eryone had a good holiday!</div>
<div><br></div><div>Thanks,</div><div>Ben</div><br><br><div class=3D"gmail_=
quote">On Tue, Nov 24, 2009 at 4:04 PM, Ben McCann <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:[email protected]">[email protected]</a>&gt;</span> wrote:<=
br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;"><div>Ah, I see. =A0That&#39;s quite differe=
nt than what I&#39;ve always used Tidy for. =A0I never use it to cleanup HT=
ML before serving it. =A0But rather use it to cleanup HTML that I feed to s=
ome automated process, in which case I generally like it acting the same as=
 the browser because I want the machines to interpret it in the same way a =
person would. =A0I very frequently will use it in unit tests to then be abl=
e to run xpath queries on the document and assert that certain data is pres=
ent. =A0I also frequently use it for data extraction tasks along the lines =
of screen scraping (e.g. I once had a consulting client who wanted me to mi=
grate a web app from his proprietary app to WordPress. =A0The DB schema was=
 a mess, so I just wrote a screen scraper to take all the data from the ren=
dered page and put it into the WordPress DB.)</div>
<div><div></div><div class=3D"h5">
<br><br><div class=3D"gmail_quote">On Tue, Nov 24, 2009 at 7:23 AM, Charlie=
 Reitzel <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"=
gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-=
left:1ex">

Hi Ger,<br>
<br>
I have been following this thread only in a general sense. =A0But it looks<=
br>
like you all are on a good track. =A0Keep it going!<br>
<br>
I also take your point about browser rendering. =A0As it happens, I have<br=
>
always used Tidy pretty much as you do. =A0 =A0Personally, mod_tidy seems l=
ike<br>
not such a great idea. =A0Tidy was never so good at what it does that a<br>
person shouldn&#39;t clean up after it sometimes. =A0I always applied it at=
 the<br>
front end. =A0I.e. When content is submitted to a CMS, not at display time.=
<br>
<br>
That said, for better or worse, browser rendering is actually the official<=
br>
reference.<br>
<br>
Way back, when we first started the project, discussions for alternative<br=
>
&quot;edits&quot; would come up again and again. =A0It did become a more or=
 less<br>
official guideline to preserve the browser rendering to the degree<br>
possible. =A0This is an application of the &quot;minimize surprises&quot; d=
esign<br>
principle. =A0It is also a tribute to the sometimes heroic lengths browsers=
<br>
will go to make a document readable (and mimic each others&#39; bugs back i=
n<br>
the 3.x/4.x era).<br>
<br>
Browsers do not always render (even good) markup the same way or (for truly=
<br>
bad markup) in an intelligible way. =A0In which case, choose =A0 the render=
ing<br>
you prefer among the available, intelligible choices.<br>
<br>
It sounds like this is actually where you are with things. =A0 I.e. are we<=
br>
dealing with markup that produces a wacky layout?<br>
<br>
Fwiw, I think Dave R.&#39;s original idea is that folks just forget the out=
er<br>
&lt;table&gt; tag sometimes. =A0&lt;tr&gt; tags too. =A0 So, if you encount=
er a naked &lt;TD&gt;,<br>
give it some clothing. =A0I don&#39;t think he had thought through the case=
s you<br>
are addressing now, which are more ambitious.<br>
<font color=3D"#888888"><br>
Charlie<br>
</font><div><br>
At 05:43 AM 11/24/2009 +0100, Ger Hobbelt wrote:<br>
&gt;On Mon, Nov 23, 2009 at 4:58 PM, Christopher Woods &lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]</a>&gt;<br>
&gt;wrote:<br>
</div><div>&gt; &gt; Are you sure that the browsers are actually turning th=
e &lt;tr&gt; content<br>
&gt; before the table into a table?<br>
&gt;<br>
</div><div>&gt;AFAICT they don&#39;t, but then browser rendering isn&#39;t =
exactly the<br>
&gt;epitome of reference for deciding what to do with shoddy html IMHO.<br>
&gt;<br>
&gt;May sound odd, but I don&#39;t use tidy to &#39;keep it looking exactly=
 the<br>
&gt;same&#39; in browsers; I use it as a, by now instinctive, part of my<br=
>
&gt;editorial workflow to ensure the servers get fed reasonably well<br>
&gt;formed HTML while I might have been doing sleight of hand in the<br>
&gt;manual edit process. In which case wrapping a &lt;table&gt; around thos=
e<br>
&gt;&lt;tr&gt;s is particularly desirable as my hands might have forgotten =
my<br>
&gt;brain wanted it in there - it happens that I sometimes outthink my<br>
&gt;typing so words get lost midway.<br>
&gt;<br>
&gt;In other words: tidy sits in an early position in the editorial<br>
&gt;workflow chain with me, not as a slapped-on webserver &#39;afterthought=
&#39;<br>
&gt;where [generated] crud is compressed into W3C standards adherence,<br>
&gt;while required to keep the &#39;intended look an feel&#39;. mod_tidy et=
 al are<br>
&gt;nice, but there are some days where I think a crossbow with serrated<br=
>
&gt;edge bolts is a far better solution to the problems mod_tidy and<br>
&gt;friends is expected to solve.<br>
&gt;<br>
&gt;Never mind that bit of early morning temper, the current state of<br>
&gt;affairs ditches the &lt;tr&gt; if it doesn&#39;t come with &lt;td&gt;s =
as well, so it<br>
&gt;discards &#39;completely misplaced &lt;tr&gt;s&#39; shall we say? At le=
ast it does<br>
&gt;now for several of my test cases, which is desirable behaviour, at<br>
&gt;least to me. [Testcases in+out to be posted later; I still suspect the<=
br>
&gt;code from hiding a couple of nasties from me]<br>
&gt;<br>
&gt; &gt;<br>
</div><div>&gt; &gt; If I remember correctly, when I did some tests on this=
 back in Feb 2006<br>
&gt; the browsers just basically stripped the &lt;tr&gt; (or maybe I only h=
ad<br>
&gt; checked &lt;td&gt;) before any table away and discarded it. =A0I put i=
n a feature<br>
&gt; request to add a new option to disable Tidy&#39;s &quot;inferred table=
&quot; functionality:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; <a href=3D"https://sourceforge.net/tracker/?func=3Ddetail&amp;aid=3D14=
29519&amp;group_id=3D27659&amp;atid=3D390966" target=3D"_blank">https://sou=
rceforge.net/tracker/?func=3Ddetail&amp;aid=3D1429519&amp;group_id=3D27659&=
amp;atid=3D390966</a><br>


&gt; &gt;<br>
&gt; &gt; It&#39;s a bit dated now as the request was filed in late Feb 200=
6 but I<br>
&gt; did note which versions of the code the diffs were created from. =A0Yo=
u<br>
&gt; *might* want to check this and see if the behavior is visually more co=
nsistent.<br>
&gt; &gt;<br>
&gt; &gt; -Chris<br>
&gt;<br>
</div><div>&gt;Hadn&#39;t checked that one, but will do, certainly. I think=
 I&#39;m much<br>
&gt;closer to your original intent now than I was when I wrote that<br>
&gt;message you responded to (and I was trying to be lazy about<br>
&gt;implementing functionality), but there are still cases where inferred<b=
r>
&gt;tables have merit: when everything but the &lt;table&gt; is missing, I&=
#39;d<br>
&gt;like to see them happen. Otherwise, completely shot &lt;tr&gt; sections=
<br>
&gt;would probably be best served without the &lt;tr&gt; at all. Trying to<=
br>
&gt;accomplish that [ballet] splits now. ;-)<br>
&gt;<br>
&gt;<br>
&gt;--<br>
</div><div><div></div><div>&gt;Met vriendelijke groeten / Best regards,<br>
&gt;<br>
&gt;Ger Hobbelt<br>
&gt;<br>
&gt;--------------------------------------------------<br>
&gt;web: =A0 =A0<a href=3D"http://www.hobbelt.com/" target=3D"_blank">http:=
//www.hobbelt.com/</a><br>
&gt; =A0 =A0 =A0 =A0 <a href=3D"http://www.hebbut.net/" target=3D"_blank">h=
ttp://www.hebbut.net/</a><br>
&gt;mail: =A0 <a href=3D"mailto:[email protected]" target=3D"_blank">ger@hobb=
elt.com</a><br>
&gt;mobile: +31-6-11 120 978<br>
&gt;--------------------------------------------------<br>
&gt;<br>
&gt;-----------------------------------------------------------------------=
-------<br>
&gt;Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30=
-Day<br>
&gt;trial. Simplify your report design, integration and deployment - and fo=
cus on<br>
&gt;what you do best, core application coding. Discover what&#39;s new with=
<br>
&gt;Crystal Reports now. =A0<a href=3D"http://p.sf.net/sfu/bobj-july" targe=
t=3D"_blank">http://p.sf.net/sfu/bobj-july</a><br>
&gt;_______________________________________________<br>
&gt;Tidy-develop mailing list<br>
&gt;<a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a><br>
&gt;<a href=3D"https://lists.sourceforge.net/lists/listinfo/tidy-develop" t=
arget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/tidy-develop<=
/a><br>
<br>
<br>
---------------------------------------------------------------------------=
---<br>
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day=
<br>
trial. Simplify your report design, integration and deployment - and focus =
on<br>
what you do best, core application coding. Discover what&#39;s new with<br>
Crystal Reports now. =A0<a href=3D"http://p.sf.net/sfu/bobj-july" target=3D=
"_blank">http://p.sf.net/sfu/bobj-july</a><br>
_______________________________________________<br>
Tidy-develop mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Tid=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/tidy-develop" targe=
t=3D"_blank">https://lists.sourceforge.net/lists/listinfo/tidy-develop</a><=
br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>

--000e0cd13b62fcfe48047c5fbc1b--


--===============4702675936980665388==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--===============4702675936980665388==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tidy-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tidy-develop

--===============4702675936980665388==--