php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29199 Tidy's "enclose-block-text" option doesn't works
Submitted: 2004-07-16 09:10 UTC Modified: 2004-07-19 04:06 UTC
From: saran at inra dot co dot th Assigned:
Status: Not a bug Package: Tidy (PECL)
PHP Version: 5.0.0 OS: Windows 2000
Private report: No CVE-ID: None
 [2004-07-16 09:10 UTC] saran at inra dot co dot th
Description:
------------
Tidy's "enclose-block-text" option doesn't works. It should insert a <p> element to enclose any text it finds in any element that allows mixed content. In example below it should insert a <p> element to enclose text inside a <td> element (as tidy.exe did with this same option set to true).

Reproduce code:
---------------
<?
$html="
<html>
<body>
<table>
<tr>
<td>Test</td>
</tr>
</table>
</body>
</html>
";
$config=array('enclose-block-text'=>1);
$tidy=tidy_parse_string($html,$config);
echo tidy_get_body($tidy);
?>

Expected result:
----------------
<body>
<table>
<tr>
<td><p>Test</p></td>
</tr>
</table>
</body>


Actual result:
--------------
<body>
<table>
<tr>
<td>Test</td>
</tr>
</table>
</body>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-18 01:44 UTC] curt@php.net
This is an issue with libtidy itself.  It wont put <p> tags around content inside of <td>'s.
 [2004-07-18 13:44 UTC] saran at inra dot co dot th
I'm quite sure that this is not bogus. I have tried various version of tidylib (from Aug, 2000 to recent version) it all did put <p> to enclose bare text inside <td> with the option 'enclose-block-text' set to true. This is what tidy's manual say http://tidy.sourceforge.net/docs/quickref.html#enclose-block-text. It seem like this option never pass to tidy.
 [2004-07-18 16:52 UTC] curt@php.net
This is being tested with 'libtidy June 1 2004'

Here is some code that should show that the config is being passed:
<?php
$html="<html>
<body>
<span>text</span>
<table><tr><td>Test</td></tr>
</table>
</body></html>
";
// with config
$config=array('enclose-block-text'=>1);
$tidy=tidy_parse_string($html,$config);
echo tidy_get_body($tidy);

// without config
$config=array('enclose-block-text'=>0);
$tidy=tidy_parse_string($html,$config);
echo tidy_get_body($tidy);

?>
 [2004-07-19 04:06 UTC] saran at inra dot co dot th
Have you try with another standalone tidy? I tried many of them and all of the result is the same ie. <p> wrap text in <td>, only libtidy on PHP don't. If this is libtidy's problem, where should I report it?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 03:01:29 2024 UTC