Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What python html generator module should I use in a non-web application?

I'm hacking a quick and dirty python script to generate some reports as static html files.

What would be a good module to easily build static html files outside the context of a web application?

My goals are simplicity (the HTML will not be very complex) and ease of use (I don't want to write a lot of code just to output some html tags).

I found two alternatives on my first goolge search:

  • markup.py - http://markup.sourceforge.net/
  • HTML.py - http://www.decalage.info/en/python/html

Also, I feel that using a templating engine would be over-kill, but if you differ please say it and why.

Any other recommendation?

like image 911
Sergio Acosta Avatar asked Dec 02 '22 04:12

Sergio Acosta


2 Answers

Maybe you could try Markdown instead, and convert it to HTML on the fly?

like image 124
clee Avatar answered Dec 04 '22 17:12

clee


You don't necessarily need something complex - for instance, here's a ~150 line library to generate HTML in a functional manner:

http://github.com/Yelp/PushmasterApp/blob/master/pushmaster/taglib.py

(Full disclosure, I work with the person who originally wrote that version, and I also use it myself.)

like image 28
Amber Avatar answered Dec 04 '22 16:12

Amber