Stencil 0.1 Released

Stencil version 0.1 has been released!

Stencil is a templating library with a number of design goals.

  • Limited code in templates. This isn’t meant to embed ruby in
    anything -
    it allows for simple control structures, since that’s typically what
    you need
    in a template, but full access to the Ruby
    interpreter is just a tempatation into sin. (From a separation of
    concerns
    standpoint.) There’s a certain amount of code available in
    conditionals and
    interpolations, since otherwise they’re much harder to do…

  • Easy to extend. If you do need something extra from a template,
    not
    having it in the templating language is frustrating. It’s easy to add
    features to stencil, since they’re described in as well-designed
    classes.

  • Generic output. Not everything is a website or a mime-encoded
    email. It’s
    nice to be able to spit out generic text from time to time.

  • Data sourced from simple datatypes - hashes and array, referenced
    with data
    paths. Views can be extracted from any object, or built up in code.

Changes:

Initial release

Project: http://rubyforge.org/project/stencil-templ/
Homepage: http://stencil-templ.rubyforge.org/

unknown wrote:

Stencil version 0.1 has been released!

Stencil is a templating library with a number of design goals.

Can you explain what advantages it has over mustache and liquid?

Both are templating languages which don’t allow ruby code to be embedded
directly and so are safe for untrusted users to write templates. Both
are suitable for non-HTML uses (although mustache does do HTML entity
escaping by default, I believe), and both are easily extended.

Your home page doesn’t give any examples of how to use it, and the
README just says:

“This is a Really Cool Ruby Thing
( That deserves better documentation than this. )”

So at the moment, I’d say you’re setting the barrier too high if you’re
hoping to generate some interest. I am interested in templating
languages in general, but I don’t want to have to reverse-engineer your
project just to see whether it might be useful to me or not.

Regards,

Brian.

On Mon, Dec 28, 2009 at 2:51 AM, Brian C. [email protected]
wrote:

Your home page doesn’t give any examples of how to use it, and the
README just says:

“This is a Really Cool Ruby Thing
( That deserves better documentation than this. )”

That’s since been updated. Apologies: the initial release announcement
was
a touch premature.

As to the advantages over liquid and mustache, I can’t be exhaustive.
Both
seem to be targeted at HTML, even if they allow for arbitrary text
output.
Stencil is designed, quite frankly, with console output in mind. As
such,
this release doesn’t have HTML tag output or HTML escaping.

Stencil is also strongly inspired by cs/template, and began because
cs/template lacked a means to reference items above the current context
(both cs/template and Stencil access data by means of paths into
hash/array
structures - inside of a loop, cs/template couldn’t refer to items
higher up
in the path)

Stencil also includes functionality to extract data into the hash/array
structure the templates require, and RSpec matchers for quickly
confirming
that the intermediary form has the appropriate structure.

Hopefully that gives you some better idea if Stencil will suit your
needs.

Judson

Judson L. wrote:

As to the advantages over liquid and mustache, I can’t be exhaustive.
Both
seem to be targeted at HTML, even if they allow for arbitrary text
output.

I have been using liquid for plain text output (generating router config
files) without anything HTML-like getting in the way.

Anyway, thanks for updating the readme and giving the background info I
was looking for.

Cheers,

Brian.