3 ms·
> I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file You are probably interested in Pyratem
by vog 16y ago
> I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file
You are probably interested in Pyratemp – a simple, well-designed and well-documented template engine that allows arbitrary Python expressions:
http://www.simple-is-better.org/template/pyratemp.html http://www.simple-is-better.org/template/pyratemp.html
BTW, I personally use the XSLT template language. It is language independent, but still extendable with user-defined functions written in the programming language of your application. Note that despite its name, XSLT does not only provide for XML output, but handles text output and HTML as well. In Python, you can find a excellent XSLT processor in the 4suite package:
http://4suite.org/docs/CoreManual.xml#xslt_engine http://4suite.org/docs/CoreManual.xml#xslt_engine
However, the syntax of XSLT is a bit clumsy, so I'll probably switch to XQuery in the future.