#46100 [Bgs]: tidy does not replace fonts with styles
| From: | lukemoynihan at gmail dot com | Date: | Sat, 25 Oct 2008 22:58:41 +0000 |
| Subject: | #46100 [Bgs]: tidy does not replace fonts with styles | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130112@lists.php.net to get a copy of this message | ||
ID: 46100
User updated by: lukemoynihan at gmail dot com
Reported By: lukemoynihan at gmail dot com
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: windows xp
PHP Version: 5.2.6
New Comment:
Are you saying its a bug in the tidy extension, or a bug in libtidy
itself?
Previous Comments:
------------------------------------------------------------------------
[2008-10-25 13:04:17] jani@php.net
Quoting that other bug: "This isn't a bug in PHP, it's a bug in the
libtidy library. Please foward this issue on to the developer's there
to have it taken care of."
------------------------------------------------------------------------
[2008-09-16 22:14:17] lukemoynihan at gmail dot com
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 this bug report at http://bugs.php.net/?id=46100&edit=1