Ruby TemplatePage Functions

EditRocket provides the following information on TemplatePage functions in the Ruby source code builder.

expand_line(line) - "Given an individual line, we look for %xxx% constructs and HREF:ref:name: constructs, substituting for each."

new(*templates) - templates is an array of strings containing the templates. We start at the first, and substitute in subsequent ones where the string !INCLUDE! occurs. For example, we could have the overall page template containing

substitute_into(lines, values) - Substitute a set of key/value pairs into the given template. Keys with scalar values have them substituted directly into the page. Those with array values invoke substitute_array (below), which examples a block of the template once for each row in the array.

write_html_on(op, value_hash) - Render the templates into HTML, storing the result on op using the method <<. The value_hash contains key/value pairs used to drive the substitution (as described above)