javiereguiluz / easybook

Book publishing as easy as it should be (built with Symfony components)
https://easycorp.io/EasyBook
Other
754 stars 81 forks source link

Use Twig {% include ... %} #150

Closed txiki31 closed 1 year ago

txiki31 commented 10 years ago

Thanks for the job ! I use Easybook many times, it's an awesome tool !

But I have a little problem... I want to build documents using the Twig include directive. The generated html contains the filename in place of the file content.

I made some test to be sure that Twig is processing files, it seems to be good (see at set value... part).

The top level file which uses the {% include %} directive :

# twig pre-processing

## Test file inclusion

{% include 'mycontent.md.twig' %}

## Test other twig instructions

{% set value = 'no spaces' %}
{#- No leading/trailing whitespace -#}
{%- if true -%}
{{- value -}}
{%- endif -%}

The included file mycontent.md.twig

** included file content  **

The ouput html file :

...
<h1 id="twig-pre-processing"><span>Chapter 1</span> twig pre-processing</h1>
<h2 id="test-file-inclusion">1.1 Test file inclusion</h2>
<p>mytest.md.twig</p>
<h2 id="test-other-twig-instructions">1.2 Test other twig instructions</h2>
<p>no spaces</p>
...

I've tried this with Easybook 4.8 and 5.0.

There is something wrong in my documents ? I didn't see any bug relating the Twig include processing... is this a feature or perhaps a bug ?

files can be uploaded here Thanks ! Marc.