[Tb] math on HTML Export?

From: Lee Phillips <lee>
Date: Fri May 20 2005 - 15:27:54 EDT

> I'm playing around with HTML export templates, and I'd like to do
> some math on retrieved attributes.

I realize that this may not be your cup of tea, but I think that
the most flexible and powerful approach to these problems is to
pass your exported Tinderbox files through a script. You would
pick a scripting language that you like, say python, and write
your Tinderbox export templates to create python expressions
involving the attributes you want manipulated; then your python
script searches for these expressions (which you have surrounded
by special markers so that the script can find them) and
evaluates them, substituting the results. In this way you can do
anything that you can figure out how to program. In fact for
most languages there are templating systems that do the parsing
and evaluating parts for you; for python, for example, there is
cheetah (both python and cheetah are free and open source; the
former comes with OS X and the latter installs easily).

It may seem baroque to write a Tinderbox template to create
another template that you then process with an external program,
but it's really not that complicated. If you want to do
arbitrary calculations on attributes I think that it is probably
the only way. Those of us (and there seem to be a handful) who
use Tinderbox to create files for LaTeX are in fact writing
Tinderbox templates to create input for another program.
Received on Fri May 20 14:30:28 2005

This archive was generated by hypermail 2.1.8 : Wed Dec 14 2005 - 10:45:38 EST