From: Matt Neimeyer on
I know I could possibly hack something together using the Tidy
libraries... (maybe...) but are there any existing php libraries /
projects that already have the ability to take some HTML and
"downgrade" the version of HTML being used.

One example: turn this...

<p style="font-weight: bold">Blah</p>

.... into ...

<p><b>Blah</b></p>

This is for an eReader I love but is long out of production and the
converter tool only works with HTML 3.2

Thanks in advance.

Matt
From: Ashley Sheridan on
On Thu, 2010-09-16 at 14:07 -0400, Matt Neimeyer wrote:

> I know I could possibly hack something together using the Tidy
> libraries... (maybe...) but are there any existing php libraries /
> projects that already have the ability to take some HTML and
> "downgrade" the version of HTML being used.
>
> One example: turn this...
>
> <p style="font-weight: bold">Blah</p>
>
> ... into ...
>
> <p><b>Blah</b></p>
>
> This is for an eReader I love but is long out of production and the
> converter tool only works with HTML 3.2
>
> Thanks in advance.
>
> Matt
>


You'd need a full on HTML parser, as what about an element that is given
a bold font from an included stylesheet? Where would you put the bold
tag then? Regular expressions really won't cut this either. Maybe it's
time to look for a different reader?

Thanks,
Ash
http://www.ashleysheridan.co.uk