<--previous | contents | next-->

Getting Started

This section gives a quick overview of Cubictemp, centered around a very simple example.

Hello walrus: A Basic Substitution Example

The simplest function of a templating system is basic substitution - that is, taking one piece of text, and inserting it into another. Consider the following line:

Hello @!foo!@.

This line is a complete Cubictemp template. It contains the single substitution tag - @!foo!@ - which we can use to insert the word "walrus" at the appropriate spot like this:

import cubictemp template = "Hello @!foo!@." temp = cubictemp.Temp(template, foo="walrus") print temp

When we run the snippet of code above, the following output is produced:

Hello walrus.

That's it - the example above is perhaps the simplest possible Cubictemp example.


<--previous | contents | next--> (11/16/04)
Cubictemp v0.4 Manual