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'd check up and see if any progress has been made in st= opping Tidy from adding spurious table tags. =A0I'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"><<a= href=3D"mailto:[email protected]">[email protected]</a>></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's quite differe= nt than what I'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"><<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>></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'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= > "edits" 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 "minimize surprises" 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' 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.'s original idea is that folks just forget the out= er<br> <table> tag sometimes. =A0<tr> tags too. =A0 So, if you encount= er a naked <TD>,<br> give it some clothing. =A0I don'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> >On Mon, Nov 23, 2009 at 4:58 PM, Christopher Woods <<a href=3D"mailt= o:[email protected]" target=3D"_blank">[email protected]</a>><br> >wrote:<br> </div><div>> > Are you sure that the browsers are actually turning th= e <tr> content<br> > before the table into a table?<br> ><br> </div><div>>AFAICT they don't, but then browser rendering isn't = exactly the<br> >epitome of reference for deciding what to do with shoddy html IMHO.<br> ><br> >May sound odd, but I don't use tidy to 'keep it looking exactly= the<br> >same' in browsers; I use it as a, by now instinctive, part of my<br= > >editorial workflow to ensure the servers get fed reasonably well<br> >formed HTML while I might have been doing sleight of hand in the<br> >manual edit process. In which case wrapping a <table> around thos= e<br> ><tr>s is particularly desirable as my hands might have forgotten = my<br> >brain wanted it in there - it happens that I sometimes outthink my<br> >typing so words get lost midway.<br> ><br> >In other words: tidy sits in an early position in the editorial<br> >workflow chain with me, not as a slapped-on webserver 'afterthought= '<br> >where [generated] crud is compressed into W3C standards adherence,<br> >while required to keep the 'intended look an feel'. mod_tidy et= al are<br> >nice, but there are some days where I think a crossbow with serrated<br= > >edge bolts is a far better solution to the problems mod_tidy and<br> >friends is expected to solve.<br> ><br> >Never mind that bit of early morning temper, the current state of<br> >affairs ditches the <tr> if it doesn't come with <td>s = as well, so it<br> >discards 'completely misplaced <tr>s' shall we say? At le= ast it does<br> >now for several of my test cases, which is desirable behaviour, at<br> >least to me. [Testcases in+out to be posted later; I still suspect the<= br> >code from hiding a couple of nasties from me]<br> ><br> > ><br> </div><div>> > If I remember correctly, when I did some tests on this= back in Feb 2006<br> > the browsers just basically stripped the <tr> (or maybe I only h= ad<br> > checked <td>) before any table away and discarded it. =A0I put i= n a feature<br> > request to add a new option to disable Tidy's "inferred table= " functionality:<br> > ><br> > ><br> > <a href=3D"https://sourceforge.net/tracker/?func=3Ddetail&aid=3D14= 29519&group_id=3D27659&atid=3D390966" target=3D"_blank">https://sou= rceforge.net/tracker/?func=3Ddetail&aid=3D1429519&group_id=3D27659&= amp;atid=3D390966</a><br> > ><br> > > It's a bit dated now as the request was filed in late Feb 200= 6 but I<br> > did note which versions of the code the diffs were created from. =A0Yo= u<br> > *might* want to check this and see if the behavior is visually more co= nsistent.<br> > ><br> > > -Chris<br> ><br> </div><div>>Hadn't checked that one, but will do, certainly. I think= I'm much<br> >closer to your original intent now than I was when I wrote that<br> >message you responded to (and I was trying to be lazy about<br> >implementing functionality), but there are still cases where inferred<b= r> >tables have merit: when everything but the <table> is missing, I&= #39;d<br> >like to see them happen. Otherwise, completely shot <tr> sections= <br> >would probably be best served without the <tr> at all. Trying to<= br> >accomplish that [ballet] splits now. ;-)<br> ><br> ><br> >--<br> </div><div><div></div><div>>Met vriendelijke groeten / Best regards,<br> ><br> >Ger Hobbelt<br> ><br> >--------------------------------------------------<br> >web: =A0 =A0<a href=3D"http://www.hobbelt.com/" target=3D"_blank">http:= //www.hobbelt.com/</a><br> > =A0 =A0 =A0 =A0 <a href=3D"http://www.hebbut.net/" target=3D"_blank">h= ttp://www.hebbut.net/</a><br> >mail: =A0 <a href=3D"mailto:[email protected]" target=3D"_blank">ger@hobb= elt.com</a><br> >mobile: +31-6-11 120 978<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 fo= cus on<br> >what you do best, core application coding. Discover what's new with= <br> >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> >_______________________________________________<br> >Tidy-develop mailing list<br> ><a href=3D"mailto:[email protected]" target=3D"_blank"= >[email protected]</a><br> ><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'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==--