Changes in work of block #695

Closed
vladimir-polyakov opened this Issue Jul 2, 2012 · 2 comments

Comments

Projects
None yet
4 participants

In the upgrading from jade 0.25.0 to 0.26.3 we have errors in this jade structure:

block globalNav 
    include globalNav

globalNav content

- var a = 2;
block globalNav
    .test #{a}

It works fine on version 0.25.0 but in 0.26.0 we have this error:

...
a is not defined
...

bramsey commented Jul 14, 2012

In 0.26 the block statement was added to let you insert a block in place of a previous block with the same name. In your example, you include global nav, which adds the variable declaration then sees the block statement for the second globalNav, telling it to override the first occurrence. This block replacement gets rid of the variable declaration node, causing the error to throw that a is not defined.

As far as I can tell this overriding is intended behavior since the blocks have the same label. You can get that snippet to work by including the variable declaration in the block like so:

block globalNav
  - var a = 2;
  .test #{a}
Contributor

vendethiel commented Mar 19, 2013

Is this working as expected ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment