Sha256: cb0e34115b91309e388ba8034fa0ed3f3e2a7219b8a8f6c18d22fc3104e32f0f
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
= FAQ <b>How do I limit the section formats that can be used?</b> There are two methods that can be used to limit the formats that of a Neapolitan template, namely, #select and #reject. After creating a Template object, use the #select and/or the #reject methods to filter out any unwanted formats. template = Neapolitan.file('example.np') template.reject{ |format| %w{liquid}.include?(format) } template.render(:name=>"Tom") These methods can be used for more aggressive validation by raising an error. template = Neapolitan.file('example.np') template.reject do |format| raise TypeError if %w{liquid}.include?(format) false end expect TypeError do template.render(:name=>"Tome") end <b>Why should template formats be listed before markup format?</b> Consider what happens if have a document section proccessed by RDoc before applying templating such as ERB: = Example Hi, <%= name %> The result never ends up utilizing ERB properly because RDoc transformed the document into: <h1>Example</h1> Hi, <%= name > Therefore you should always list the template format before markup formats. Of course usually template formats are not used on section by section basis in anycase, so this won't be an issue, but it's good to know just in case.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
neapolitan-0.4.1 | demo/02_faq.rdoc |
neapolitan-0.4.0 | demo/02_faq.rdoc |