8.6 #attr

Syntax:

#attr $var = EXPR

The #attr directive creates class attributes in the generated Python class. It should be used to assign simple Python literals such as numbers or strings. In particular, the expression must not depend on searchList values or #set variables since those are not known at compile time.

#attr $title = "Rob Roy"
#attr $author = "Sir Walter Scott"
#attr $version = 123.4

This template or any child template can output the value thus:

$title, by $author, version $version

If you have a library of templates derived from etexts (http://www.gutenberg.org/), you can extract the titles and authors and put them in a database (assuming the templates have been compiled into .py template modules):