I have figured out how to extract the information I need from a PDF file using PDFMiner in Python, and now I need to write out a modified version of the document with only the information that's needed as an HTML file. The new version will be archived online to a repository, and a printed copy shipped with the unit.
What is the best way to write this document (a header, a logo, and a table with parameters and pass/fail limits) from Python?
HTMLGen?
Or is there a better, newer Python package?
I can write my own package to write HTML, but surely someone else has done this already.
-
Genshi is perfect for these things.
-
Jinja2 is nice too.
Ali A : Interestingly I prefer to use Jinja2 for templating, but I answered Genshi for this question. Why? because Genshi actually has HTML "generation" Jinja2 doesn't, it's just a (very very good) templating library. -
Also Cheetah and Clearsilver... I bet if you looked around you could find hundreds of possibilities. Dynamic websites are a Very Big Thing these days and they all need some sort of templating system, so plenty have been developed. Try a Google search for something like "Python templating" to find more. (First hit: http://wiki.python.org/moin/Templating)
-
In the past I've had a lot of luck with SimpleTAL (a stand-alone version of zope's Page Template Library)
Today, I'd use Django's templates (which can be used stand-alone) because I love some of the markups like {% ifchanged %} {% nospace %} {% firstof %} etc...
Steve Losh : I'm working on a project and decided to use Jinja for the templating instead of Django's templates just to try it out... All of the sweet predefined filters/tags are what I miss most. Although I have to admit that Jinja's lipsum() function is really handy. -
Don't forget Mako.
-
Mako = Blazing Fast. Can do a lot. You need to spend time on it.
Genshi = A better Kid. XML based. Sucks at generating non html/xml.
Jinja2 = Django Templates with some other beauties.
pyTenjin = Little know but you might like it.
-
If the HTML you want to generate is exceedingly dynamic you might not be able to write an elegant template for it, so things like HTMLGen or pyhtmloo could be the way to go.
0 comments:
Post a Comment