Re: Tidy bug
Ben McCann <[email protected]> Sun, 22 Nov 2009 21:59:27 -0800
| Newsgroups | gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============5959183449952566049== Content-Type: multipart/alternative; boundary=000e0cd254f23aa0fb0479038754 --000e0cd254f23aa0fb0479038754 Content-Type: text/plain; charset=ISO-8859-1 Thanks Ger! I really appreciate you taking the time to look at this. I agree I would not expect the extra 'gobbledigook' text to land before the table. And if the <tr>content</tr> is going to be turned into a full table then I imagine I would expect the content to remain within the table. I think what you've changed thus far is an improvement over the previous functioning though since we are not losing any data as before (the table id). Thanks! Ben On Sat, Nov 21, 2009 at 12:08 AM, Ger Hobbelt <[email protected]> wrote: > Gentlemen, > > The first edit; it's not perfect, but at least we're getting > somewhere. It's currently coded and under test, so criticisms are > welcomed. > > (Note that these changes are not in CVS; for that to happen I'd need > to finish the edit + file a patch + get it accepted. It's local copy > only just now.) > > > Note that in sample A two grave mistakes in the HTML (missing table + > missing td) cause tidy to infer a <table>, then run into > table-'illegal' content after the </tr> which is pushed to the front > of the table as per standing rules (I didn't touch that part ;-) ), so > the result is far from perfect -- eyeballing the input, one would > /not/ expect the extra 'gobbledigook' text to land /before/ the table, > but that's what tidy does; after all, it treats 'inferred' tables just > like the real thing. > I'm thinking about changing that last bit of logic too when time > allows tomorrow, i.e. terminate inferred <tables> as soon as 'illegal' > content like that is found, instead of moving that 'illegal' content > around -- which is A-okay for real tables. > > [OT: And then there's that extra single whitespace which might have > been introduced between 'bla' and 'and' if tidy were a truly bright > boy... but that's harder to accomplish because that requires knowledge > about which tags introduce some sort of hor/vert whitespace... wait, > that's what CM_BLOCK tells us. Hmmmm] > > > Sample B shows a double sample: the first half is sample A without the > extra text between the 'tables', so it doesn't show the damage to the > extent visible in A, while the second half is more what one might > expect: a missing <table> tag but otherwise the content properly > placed within <td>'s. And that's correctly rendered -- if the extra > table is indeed considered acceptable behaviour. > > > > > > ---input A (original but with a bit of content in TD)--- > > <html> > <body> > <tr>Bla bla bla</tr> > and some more gobbledigook... > <table id="companyAccountsTable"> > <tbody><tr><td>jschmoe</td></tr></tbody> > </table> > </body> > </html> > > ---------------- > > > ---output A (original but with a bit of content in TD)--- > > line 1 column 1 - Warning: missing <!DOCTYPE> declaration > line 3 column 1 - Warning: <tr> isn't allowed in <body> elements > line 2 column 1 - Info: <body> previously mentioned > line 3 column 1 - Warning: inserting implicit <table> > line 3 column 5 - Warning: plain text isn't allowed in <tr> elements > line 3 column 1 - Info: <tr> previously mentioned > line 3 column 16 - Warning: missing <td> > line 4 column 1 - Warning: plain text isn't allowed in <table> elements > line 3 column 1 - Info: <table> previously mentioned > line 2 column 1 - Warning: inserting missing 'title' element > line 3 column 1 - Warning: <table> lacks "summary" attribute > line 5 column 1 - Warning: <table> lacks "summary" attribute > line 10 column 1 - Warning: empty 'title' element and no header found: > 'title' remains empty > Info: Document content looks like HTML 4.01 Strict > Info: No system identifier in emitted doctype > 10 warnings, 0 errors were found! > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> > > <html> > <head> > <meta name="generator" content= > "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"> > > <title></title> > </head> > > <body> > Bla bla blaand some more gobbledigook... > > <table> > <tr> > <td></td> > </tr> > </table> > > <table id="companyAccountsTable"> > <tbody> > <tr> > <td>jschmoe</td> > </tr> > </tbody> > </table> > </body> > </html> > > ----------------- > > > > > > ---input B (without and with TD in leading TR)--- > > <html> > <body> > <!-- two wrongs in one line: table + td... --> > <tr>Bla bla bla</tr> > <table id="companyAccountsTable"> > <tbody><tr><td>jschmoe</td></tr></tbody> > </table> > <hr /> > <!-- and now with only a single mistake: <table> missing --> > <hr /> > <tr><td>Bla (bis 3x)</tr> > <table id="companyAccountsTable"> > <tbody><tr><td>jschmoe</td></tr></tbody> > </table> > </body> > </html> > > ---------------- > > ---output B (without and with TD in leading TR)--- > > line 1 column 1 - Warning: missing <!DOCTYPE> declaration > line 4 column 1 - Warning: <tr> isn't allowed in <body> elements > line 2 column 1 - Info: <body> previously mentioned > line 4 column 1 - Warning: inserting implicit <table> > line 4 column 5 - Warning: plain text isn't allowed in <tr> elements > line 4 column 1 - Info: <tr> previously mentioned > line 4 column 16 - Warning: missing <td> > line 11 column 1 - Warning: <tr> isn't allowed in <body> elements > line 2 column 1 - Info: <body> previously mentioned > line 11 column 1 - Warning: inserting implicit <table> > line 2 column 1 - Warning: inserting missing 'title' element > line 4 column 1 - Warning: <table> lacks "summary" attribute > line 5 column 1 - Warning: <table> lacks "summary" attribute > line 11 column 1 - Warning: <table> lacks "summary" attribute > line 12 column 1 - Warning: <table> anchor "companyAccountsTable" > already defined > line 12 column 1 - Warning: <table> lacks "summary" attribute > line 17 column 1 - Warning: empty 'title' element and no header found: > 'title' remains empty > Info: Document content looks like HTML 4.01 Strict > Info: No system identifier in emitted doctype > 14 warnings, 0 errors were found! > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> > > <html> > <head> > <meta name="generator" content= > "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"> > > <title></title> > </head> > > <body> > <!-- two wrongs in one line: table + td... --> > Bla bla bla > > <table> > <tr> > <td></td> > </tr> > </table> > > <table id="companyAccountsTable"> > <tbody> > <tr> > <td>jschmoe</td> > </tr> > </tbody> > </table> > <hr> > <!-- and now with only a single mistake: <table> missing --> > <hr> > > <table> > <tr> > <td>Bla (bis 3x)</td> > </tr> > </table> > > <table id="companyAccountsTable"> > <tbody> > <tr> > <td>jschmoe</td> > </tr> > </tbody> > </table> > </body> > </html> > > ----------------- > > > > -- > 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 > --000e0cd254f23aa0fb0479038754 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div>Thanks Ger! =A0I really appreciate you taking the time to look at this= . =A0I agree I would not expect the=A0<span class=3D"Apple-style-span" styl= e=3D"font-family: arial, sans-serif; font-size: 13px; border-collapse: coll= apse; ">extra 'gobbledigook' text to land before the table. =A0And = if the <tr>content</tr> is going to be turned into a full table= then I imagine I would expect the content to remain within the table. =A0I= think what you've changed thus far is an improvement over the previous= functioning though since we are not losing any data as before (the table i= d).</span></div> <div><span class=3D"Apple-style-span" style=3D"font-family: arial, sans-ser= if; font-size: 13px; border-collapse: collapse; "><br></span></div><div><sp= an class=3D"Apple-style-span" style=3D"font-family: arial, sans-serif; font= -size: 13px; border-collapse: collapse; ">Thanks!</span></div> <div><span class=3D"Apple-style-span" style=3D"font-family: arial, sans-ser= if; font-size: 13px; border-collapse: collapse; ">Ben</span></div><div><spa= n class=3D"Apple-style-span" style=3D"font-family: arial, sans-serif; font-= size: 13px; border-collapse: collapse; "><br> </span></div><br><div class=3D"gmail_quote">On Sat, Nov 21, 2009 at 12:08 A= M, Ger Hobbelt <span dir=3D"ltr"><<a href=3D"mailto:[email protected]">ger= @hobbelt.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" sty= le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> Gentlemen,<br> <br> The first edit; it's not perfect, but at least we're getting<br> somewhere. It's currently coded and under test, so criticisms are<br> welcomed.<br> <br> (Note that these changes are not in CVS; for that to happen I'd need<br= > to finish the edit + file a patch + get it accepted. It's local copy<br= > only just now.)<br> <br> <br> Note that in sample A two grave mistakes in the HTML (missing table +<br> missing td) cause tidy to infer a <table>, then run into<br> table-'illegal' content after the </tr> which is pushed to th= e front<br> of the table as per standing rules (I didn't touch that part ;-) ), so<= br> the result is far from perfect -- eyeballing the input, one would<br> /not/ expect the extra 'gobbledigook' text to land /before/ the tab= le,<br> but that's what tidy does; after all, it treats 'inferred' tabl= es just<br> like the real thing.<br> I'm thinking about changing that last bit of logic too when time<br> allows tomorrow, i.e. terminate inferred <tables> as soon as 'ill= egal'<br> content like that is found, instead of moving that 'illegal' conten= t<br> around -- which is A-okay for real tables.<br> <br> [OT: And then there's that extra single whitespace which might have<br> been introduced between 'bla' and 'and' if tidy were a trul= y bright<br> boy... but that's harder to accomplish because that requires knowledge<= br> about which tags introduce some sort of hor/vert whitespace... wait,<br> that's what CM_BLOCK tells us. Hmmmm]<br> <br> <br> Sample B shows a double sample: the first half is sample A without the<br> extra text between the 'tables', so it doesn't show the damage = to the<br> extent visible in A, while the second half is more what one might<br> expect: a missing <table> tag but otherwise the content properly<br> placed within <td>'s. And that's correctly rendered -- if the= extra<br> table is indeed considered acceptable behaviour.<br> <br> <br> <br> <br> <br> ---input A (original but with a bit of content in TD)---<br> <br> <html><br> <body><br> <tr>Bla bla bla</tr><br> and some more gobbledigook...<br> <div class=3D"im"><table id=3D"companyAccountsTable"><br> <tbody><tr><td>jschmoe</td></tr></tbody>= ;<br> </table><br> </body><br> </html><br> <br> </div>----------------<br> <br> <br> ---output A (original but with a bit of content in TD)---<br> <br> line 1 column 1 - Warning: missing <!DOCTYPE> declaration<br> <div class=3D"im">line 3 column 1 - Warning: <tr> isn't allowed i= n <body> elements<br> </div>line 2 column 1 - Info: <body> previously mentioned<br> line 3 column 1 - Warning: inserting implicit <table><br> line 3 column 5 - Warning: plain text isn't allowed in <tr> eleme= nts<br> line 3 column 1 - Info: <tr> previously mentioned<br> line 3 column 16 - Warning: missing <td><br> line 4 column 1 - Warning: plain text isn't allowed in <table> el= ements<br> line 3 column 1 - Info: <table> previously mentioned<br> line 2 column 1 - Warning: inserting missing 'title' element<br> line 3 column 1 - Warning: <table> lacks "summary" attribut= e<br> line 5 column 1 - Warning: <table> lacks "summary" attribut= e<br> line 10 column 1 - Warning: empty 'title' element and no header fou= nd:<br> 'title' remains empty<br> Info: Document content looks like HTML 4.01 Strict<br> Info: No system identifier in emitted doctype<br> 10 warnings, 0 errors were found!<br> <br> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><br> <br> <html><br> <head><br> =A0<meta name=3D"generator" content=3D<br> =A0"HTML Tidy for Windows (vers 25 March 2009), see <a href=3D"http:/= /www.w3.org" target=3D"_blank">www.w3.org</a>"><br> <br> =A0<title></title><br> </head><br> <br> <body><br> =A0Bla bla blaand some more gobbledigook...<br> <br> =A0<table><br> =A0 =A0<tr><br> =A0 =A0 =A0<td></td><br> =A0 =A0</tr><br> =A0</table><br> <div class=3D"im"><br> =A0<table id=3D"companyAccountsTable"><br> =A0 =A0<tbody><br> =A0 =A0 =A0<tr><br> =A0 =A0 =A0 =A0<td>jschmoe</td><br> =A0 =A0 =A0</tr><br> =A0 =A0</tbody><br> =A0</table><br> </body><br> </html><br> <br> </div>-----------------<br> <br> <br> <br> <br> <br> ---input B (without and with TD in leading TR)---<br> <br> <html><br> <body><br> <!-- two wrongs in one line: table + td... --><br> <tr>Bla bla bla</tr><br> <div class=3D"im"><table id=3D"companyAccountsTable"><br> <tbody><tr><td>jschmoe</td></tr></tbody>= ;<br> </table><br> </div><hr /><br> <!-- and now with only a single mistake: <table> missing --><br= > <hr /><br> <tr><td>Bla (bis 3x)</tr><br> <div class=3D"im"><table id=3D"companyAccountsTable"><br> <tbody><tr><td>jschmoe</td></tr></tbody>= ;<br> </table><br> </body><br> </html><br> <br> </div>----------------<br> <br> ---output B (without and with TD in leading TR)---<br> <br> line 1 column 1 - Warning: missing <!DOCTYPE> declaration<br> <div class=3D"im">line 4 column 1 - Warning: <tr> isn't allowed i= n <body> elements<br> </div>line 2 column 1 - Info: <body> previously mentioned<br> line 4 column 1 - Warning: inserting implicit <table><br> line 4 column 5 - Warning: plain text isn't allowed in <tr> eleme= nts<br> line 4 column 1 - Info: <tr> previously mentioned<br> line 4 column 16 - Warning: missing <td><br> line 11 column 1 - Warning: <tr> isn't allowed in <body> el= ements<br> line 2 column 1 - Info: <body> previously mentioned<br> line 11 column 1 - Warning: inserting implicit <table><br> line 2 column 1 - Warning: inserting missing 'title' element<br> line 4 column 1 - Warning: <table> lacks "summary" attribut= e<br> line 5 column 1 - Warning: <table> lacks "summary" attribut= e<br> line 11 column 1 - Warning: <table> lacks "summary" attribu= te<br> line 12 column 1 - Warning: <table> anchor "companyAccountsTable= "<br> already defined<br> line 12 column 1 - Warning: <table> lacks "summary" attribu= te<br> line 17 column 1 - Warning: empty 'title' element and no header fou= nd:<br> 'title' remains empty<br> Info: Document content looks like HTML 4.01 Strict<br> Info: No system identifier in emitted doctype<br> 14 warnings, 0 errors were found!<br> <br> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><br> <br> <html><br> <head><br> =A0<meta name=3D"generator" content=3D<br> =A0"HTML Tidy for Windows (vers 25 March 2009), see <a href=3D"http:/= /www.w3.org" target=3D"_blank">www.w3.org</a>"><br> <br> =A0<title></title><br> </head><br> <br> <body><br> =A0<!-- two wrongs in one line: table + td... --><br> =A0Bla bla bla<br> <br> =A0<table><br> =A0 =A0<tr><br> =A0 =A0 =A0<td></td><br> =A0 =A0</tr><br> =A0</table><br> <div class=3D"im"><br> =A0<table id=3D"companyAccountsTable"><br> =A0 =A0<tbody><br> =A0 =A0 =A0<tr><br> =A0 =A0 =A0 =A0<td>jschmoe</td><br> =A0 =A0 =A0</tr><br> =A0 =A0</tbody><br> =A0</table><br> </div> =A0<hr><br> =A0<!-- and now with only a single mistake: <table> missing -->= ;<br> =A0<hr><br> <br> =A0<table><br> =A0 =A0<tr><br> =A0 =A0 =A0<td>Bla (bis 3x)</td><br> =A0 =A0</tr><br> =A0</table><br> <div class=3D"im"><br> =A0<table id=3D"companyAccountsTable"><br> =A0 =A0<tbody><br> =A0 =A0 =A0<tr><br> =A0 =A0 =A0 =A0<td>jschmoe</td><br> =A0 =A0 =A0</tr><br> =A0 =A0</tbody><br> =A0</table><br> </body><br> </html><br> <br> </div>-----------------<br> <br> <br> <br> --<br> <div><div></div><div class=3D"h5">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://ww= w.hobbelt.com/</a><br> =A0 =A0 =A0 =A0<a href=3D"http://www.hebbut.net/" target=3D"_blank">http:/= /www.hebbut.net/</a><br> mail: =A0 <a href=3D"mailto:[email protected]">[email protected]</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 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]">[email protected]= urceforge.net</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> --000e0cd254f23aa0fb0479038754-- --===============5959183449952566049== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ 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 --===============5959183449952566049== 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 --===============5959183449952566049==--