todvora / gitbook-plugin-image-captions

Image captions plugin for GitBook
Apache License 2.0
44 stars 18 forks source link

Image captions are not applied to images within {% if %} statements #22

Open cdrfun opened 7 years ago

cdrfun commented 7 years ago

Using the current gitbook and gitbook-plugin-image-captions images within version {% if %} seem to be ignored. I didn't try other Templating features, but I gues they won't work either. If needed I can supply a demo gitbook, but it make take some time to prepare ;)

cdrfun commented 7 years ago

I've found a workaround: Instead of writing

{% if book.projectName == "One" %}
  ![One](assets/one.png)
{% elif book.projectName == "Two" %}
  ![Two](assets/two.png)
{% endif %}

This one works:

{% if book.projectName == "One" %}

![One](assets/one.png)

{% elif book.projectName == "Two" %}

![Two](assets/two.png)

{% endif %}

I can't judge of this is intended or not, but for me the first example should work too.