[reportlab-users] Alternative paragraph implementation with HTML and CSS
dirk.holtwick at gmail.com
Tue Jul 14 11:13:15 EDT 2009
while cleaning up my computer I found some old code I worked on last
year. It is not completed but some stuff already works.
This is basically a new paragraph implementation based on some kind of
box model. It takes a DOM structure with CSS style informations and then
renders the corresponding paragraph. Maybe this could become interesting
as a sophisticated paragraph replacement in the RL toolkit some time.
Here is the code:
The parsing of the HTML and the enriching of the DOM with CSS style
information can be done in various ways. In the test implementation I
use the html5lib and Techgames CSS parser. But here is an example of how
this might be achieved by using lxml and cssutils too.
Genshi might also be a good solution. Here is some CSS to DOM mapping
Since I will not find the time to bring this effort to an end quite
soon, maybe someone else is interested in helping out here. For now this
source is licensed under GPLv2 but it would be okay for me to license
some portions under MIT license too, if there is interest in it.
Hope you find this helpful.
More information about the reportlab-users