Possible problem: if FONT is only child of parent <td> element.. .

Hello everyone-

I'm new to the list, and I've found what I believe to
be a problem in Tidy.  I realize those are famous newbie
last words, so please hear me (or read me) out.

Consider the following sample HTML File with a single table,
containing a single element, with a specified font:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td><font face="arial" size=5>first font</font></td>
</tr>
</table>
</body>
</html>

After running though Tidy with a the following config file:

// config file for HTML tidy
markup: yes
clean: yes
show-warnings: yes

I get the following (incorrect) output:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td>first font</td>
</tr>
</table>
</body>
</html>

Note that my font specification for the table element
has been removed.  Ideally, I think something like the 
following should have been generated (note that the 
font specification was converted to a class and assigned
to the parent <td> element):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
<style type="text/css">
 td.c1 {font-family: arial; font-size: 150%}
</style>
</head>
<body>
<table>
<tr>
<td class="c1">first font</td>
</tr>
</table>
</body>
</html>

Less ideal, but still acceptable would have been the
following (note that the font specification for the
table element has been converted to a <span> and class):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
<style type="text/css">
 span.c1 {font-family: arial; font-size: 150%}
</style>
</head>
<body>
<table>
<tr>
<td><span class="c1">first font</span></td>
</tr>
</table>
</body>
</html>

Is there an option to achieve either of the desired results
above?  From looking at the source, this seems to have been
an intentional "effect" of the Font2Span() clean-up
code which discards a <font> tag that is the only child 
of *any* parent element.

Can anyone offer any suggestions or confirmations?

Thanks.
-Shane

Received on Monday, 27 September 1999 14:34:07 UTC