foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

Is it possible to output processed and unprocessed blocks with a helper? #140

Closed CGTS closed 6 years ago

CGTS commented 6 years ago

I'm trying to create a helper that renders the html for a partial block and generates a code example of that partial.

for example this:

<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

would produce this:

html:
----------
<div class="wrapper">
  <div>first</div>
  <div>second</div>
</div>
----------
example:
----------
<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

I can use a {{{{raw}}}} block helper or \{{{escape}}}}, this works for the example but not the html. Is there a way to output both without needing to repeat myself in the code like:

<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

{{{{raw-helper}}}}
  <div class="wrapper">
    {{> first}}
    {{> second}}
  </div>
{{{{/raw-helper}}}}

Is this possible?

CGTS commented 6 years ago

If anyone else runs into this issue it was solved here https://github.com/wycats/handlebars.js/issues/1385