#46100 [NEW]: tidy does not replace fonts with styles
| From: | lukemoynihan at gmail dot com | Date: | Tue, 16 Sep 2008 22:14:17 +0000 |
| Subject: | #46100 [NEW]: tidy does not replace fonts with styles | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-129036@lists.php.net to get a copy of this message | ||
From: lukemoynihan at gmail dot com
Operating system: windows xp
PHP version: 5.2.6
PHP Bug Type: Unknown/Other Function
Bug description: tidy does not replace fonts with styles
Description:
------------
when tidy has the 'clean' option set it should convert font tags into css
styles, php's tidy extension does not seem to do this. I found this problem
mentioned in bug #28841 however it is marked as wont fix, i cannot see
problems like this with tools built upon recent versions of libtitdy, has
the issue been fixed since 2004?
Reproduce code:
---------------
<?php
$testHtml = <<<FILTHY
<P></P><TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0><TBODY><TR><TD width="65%">
<STRONG><FONT color=#cc9900>persons name
<BR></FONT>(occupation)</STRONG></TD>
<TD vAlign=top align=right abbr="" chOff="" headers=""
width="45%"
background="" ch="" rowSpan=2>
<IMG title="title text" alt="alt text"
src="http://www.example.com/image.jpg" border=0
name="img name"></TD>
</TR><TR><TD vAlign=top abbr="" chOff="" headers=""
width="65%"
background="" ch="">
<P>some text.
<BR></P><P></P></TD></TR></TBODY></TABLE>
FILTHY;
$tidy = new tidy();
$tidyConfig = array('clean'=>true);
$tidy->parseString($testHtml, $tidyConfig);
$tidy->cleanRepair();
$testHtml = (string)$tidy;
var_dump($testHtml);
Expected result:
----------------
Produced from other tools that use libtitdy: (note the style added)
<html>
<head>
<title></title>
<style type="text/css">
span.c1 {color: #CC9900}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="3" width="100%"
border="0">
<tbody>
<tr>
<td width="65%">
<strong>
<span class="c1">persons name
<br /></span> (occupation)</strong>
</td>
<td valign="top" align="right" abbr="" choff=""
headers=""
width="45%" background="" ch="" rowspan="2">
<img title="title text" alt="alt text"
src="http://www.example.com/image.jpg"
border="0"
name="img name" />
</td>
</tr>
<tr>
<td valign="top" abbr="" choff="" headers=""
width="65%"
background="" ch="">
<p>some text.
<br /></p>
</td>
</tr>
</tbody>
</table>
</body>
</html>
Actual result:
--------------
string(589) "<html>
<head>
<title></title>
</head>
<body>
<table cellspacing="0" cellpadding="3" width="100%"
border="0">
<tbody>
<tr>
<td width="65%"><strong>persons name<br>
(occupation)</strong></td>
<td valign="top" align="right" abbr="" choff=""
headers="" width=
"45%" background="" ch="" rowspan="2"><img
title="title text" alt=
"alt text" src="http://www.example.com/image.jpg"
border="0" name=
"img name"></td>
</tr>
<tr>
<td valign="top" abbr="" choff="" headers=""
width="65%"
background="" ch="">
<p>some text.<br></p>
</td>
</tr>
</tbody>
</table>
</body>
</html>
"
--
Edit bug report at http://bugs.php.net/?id=46100&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46100&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46100&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46100&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46100&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=46100&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46100&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46100&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46100&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46100&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46100&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46100&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46100&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46100&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46100&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46100&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46100&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46100&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46100&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46100&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46100&r=mysqlcfg