Module: BoilerPlate Author: Brad Howes (bhowes@cssun3.corp.mot.com) Version: 1.0 BoilerPlate is a collection of classes that provide simple yet powerful macro-type processing of Python text. Blocks within text can be conditionally included or excluded based on runtime values. Also, text blocks can be iterated over by a sequence or a dictionary. Although BoilerPlate was based on ideas found in Jim Fulton's DocTemplate module, it is *not* a replacement. Most notably, only dictionaries are support in the __init__ and __call__ methods of the BoilerPlate classes, whereas Fulton's code supports an instance variable and name resolution for it. Also, the HTML server-side include format is not recognized, and the block tag structures are radically different. The following tags are recognized within text blocks: o @if : -- start of a conditional block. Condition is evaluated at format time and if it returns a Python `true' value, the text block is formatted. o @for in : -- start of an iteration block. Data is evaluated at format time and is iterated over. Unlike Python's `for' statement, this one supports dictionaries the value for . The following data elements are available within a `for' block iteration over a sequence: o .counter -- count of values; starts at 1 o .index -- index of value in sequence; starts at 0 o .value -- current value in iteration These values are available for dictionary iterations: o .key -- current key value in iteration o .value -- current value in iteration Finally, `for' blocks attempt to calculate statistics based on the values in the iteration. See class `ForCooker' for more info about these. o @elif : -- (only available after an @if block). Condition is evaluated at format time if the owning @if block or previous @elif block did not format. o @else: -- (only after an @if or @elif block). Represents text to format if all preceding @if and @elif blocks returned a Python `false'.