HTML stylesheet expander?

Duncan Booth duncan.booth at invalid.invalid
Wed Nov 24 04:18:37 EST 2004


Roger Binns wrote:

> Does anyone have any code or pointers to something
> that can take some HTML with CSS style information
> and expand it into HTML that works pre-CSS.
> 

It can't be done in general since CSS has far more control over the styling 
than HTML ever gave you. However, if you are willing to restrict yourself 
to simple cases I would suggest you might be best loading the HTML into a 
browser and manipulating it there to find out what styles everything has. 

If you are using Windows then there is no problem: just drive IE remotely 
through COM and use Python to iterate over the document and pick out the 
runtime style attributes that you are interested in.

If you are not using Windows, or you want portability, then you are 
probably best doing this in Javascript.




More information about the Python-list mailing list