Escaped Erubis filter for Nanoc.
A minor, but useful, modification of Nanoc's default Erubis filter, by Christopher Boone.
The Escaped Erubis filter works exactly like the regular Erubis filter, except that it uses Erubis::EscapedEruby
in place of Erubis::Eruby
. The EscapedEruby
class switches the behavior of <%= %>
and <%== %>
, meaning that <%= %>
escapes its contents and <%== %>
does not. (The opposite of standard Erubis and Erb behavior.)
The Escaped Erubis filter also includes the ErboutEnhancer, which makes Eruby use _erbout
as its buffer, in addition to its usual _buf
. Thus filters and other code, such as those included with Nanoc, that assume you're using Erb, and that Erb is using _erbout
, will work correctly when filtered with Escaped Erubis.
Just drop the filters
folder into your project's /lib
directory.
Or, if /lib/filters
already exists, then add the escaped_erubis.rb
file to it.
To filter an item with Escaped Erubis, use:
filter :escaped_erubis
To filter a layout, use something like this:
layout '*', :escaped_erubis
- The Erubis project site: http://www.kuwata-lab.com/erubis/
- The Erubis user's guide: http://www.kuwata-lab.com/erubis/users-guide.html
Erubis::EscapedEruby
: http://www.kuwata-lab.com/erubis/users-guide.02.html#tut-escape
- The Nanoc user manual: http://nanoc.stoneship.org/docs/
- The filters section, in the Nanoc user manual: http://nanoc.stoneship.org/docs/4-basic-concepts/#filters
- The Nanoc project site: http://nanoc.stoneship.org/
- Nanoc's Mercurial project: http://projects.stoneship.org/hg/nanoc/
- Nanoc's Github mirror: http://github.com/ddfreyne/nanoc
- The Nanoc Trac (wiki and issue tracker): http://projects.stoneship.org/trac/nanoc
- Nanoc's API documentation: http://nanoc.stoneship.org/docs/api/3.1/