Generating HTML from python

Roger Binns rogerb at rogerbinns.com
Fri Jun 10 13:08:48 EDT 2005


"Philippe C. Martin" <philippe at philippecmartin.com> wrote in message news:HPWpe.2034$I14.173 at newssvr12.news.prodigy.com...
> Hi,
>
> I wish to use an easy way to generate reports from wxPython and feel
> wxHtmlEasyPrinting could be a good solution.
>
> I now need to generate the HTML wxHtmlEasyPrinting can print: I need to have
> a title followed by lines of text that do not look too ugly. If possible I
> would like to use an existing module.
>
> Q1) Is there such a module ?
> Q2) Is my approach fairly good ?

There is one huge problem with wxHtml and consequently wxHtmlEasyPrinting.  It
doesn't understand stylesheets in any way.  There are many packages that
generate HTML, but they all expect a lot of the styling to be handled by
CSS.  It is also a lot easier to write that way.

I would absolutely love a piece of code that could take CSS and HTML and
apply the CSS to the HTML to get the right appearance, but without any
CSS left.  For example it would turn CSS formatting for class/div/span
into HTML attributes, as well as overal formatting instructions.

I did do something similar for BitPim but it requires the HTML to be perfect
and the CSS is actually a Python data structure expressing the attributes and
how they get applied.  I'd love to replace it with something better.

But ultimately it does work.

Roger






More information about the Python-list mailing list