cs/Template 0.1.2
···
====================
cs/Template is a fast, generic text templating engine for Ruby, written in C.
Merge native Ruby data structures with text templates to produce final
documents. Data structures may be any combination of Hashes, Arrays and
Objects (works great with YAML input). Produces any type of text document.
Place variables or eval statements anywhere in templates with path-like
addressing, control block execution with if/then/else and generate looping
blocks of text.
project homepage: http://rubyforge.org/projects/cstemplate/
download url: http://rubyforge.org/frs/?group_id=276&release_id=549
Example code
require "celsoft.com/template"
require "yaml"
template = Template::Document.new
template.data = YAML::load <<-END
---
author:
name : Dallas Diegler
email: whack@mole.com
title : Interesting things I've done
type : leaflet
END
template.load <<-END
${var title}
A ${var type} by ${var author/name}
email: ${var author/email}
END
print(template.output)
Sean O'Dell