diary @ telent

text-template#

Sun Apr 16 19:19:50 2006

"Design" is a very strong word. From time to time when writing Lisp (rare enough in itself, I know) I factor out stuff that seems like the nucleus of a good idea and potentially even reusable code - sexql is one example you might have come across, and dbs is another that you (I hope) won't - because it doesn't exist anywhere other than my laptop and in a few backup locations. (Unless you're the swine that stole my last laptop, anyway)

I'm never quite sure what to do about release-engineering for this kind of stuff. It's not finished enough that I feel good about reserving part of the global CL namespace to refer to it (especially on days when I'm not feeling imaginative and so give it a really generic name), but it's often still potentially useful to other people and just sitting on it - or posting it to an unindexed "transient" forum like small-cl-src - seems also suboptimal.

With that in mind, here's an announcement of the first available version of Text-Template: a poor rip-off of Mark Jason Dominus' Text::Template Perl module, for Lisp.

Example

Suppose a file test-template with the following contents:

here is some text
  1. <(side-effect) ( 2 3)># and some more text ## here
we do
TEXT-TEMPLATE> (with-open-file (i "test-template") 
                    (make-instance 'text-template :stream i))
#

TEXT-TEMPLATE> (fill-in  standard-output)
here is some text
6
and some more text T here
NIL
For more information, see http://www.cliki.net/text-template