pugjade4j

Incorrect pug/jade variable scope using jade4j


I am trying the following jade template. My expectation is that at the end of the loop the value of test should be 5

-test = 0
-var array = [1,2,3,4,5]

p before loop: #{test}
for element in array
  - test++
p after loop: #{test}

And actually is working in the fiddle: http://jsfiddle.net/so5tqp35/ there the output is:

before loop: 0
after loop: 5

In my local webserver that is not working and I have

before loop: 0
after loop: 0

Without any errors appearing. I am using springboot with this plugin that takes care of the jade files.

<dependency>
  <groupId>de.neuland-bfi</groupId>
  <artifactId>spring-jade4j</artifactId>
  <version>1.2.3</version>
</dependency>

So it seems that there is something wrong in the workflow and the variable does not get overwritten. How can I find some hints on what is wrong?


Solution

  • The problem lies in the plugin that I am using : de.neuland-bfi

    There is already a bug report addressing the issue: https://github.com/neuland/jade4j/issues/153