n-tags showing upin source if block name is a variable (Latte standalone)

2 years ago

tpr
Member | 55
+
0
-

Using this code produces n-tags showing up in the html source. See also the inspector screenshot (there are n:foreach and n:if macros in the corresponding code).

{layout 'layouts/@' . $layout .'.latte'}

{var $main_block = $layout == 'default' ? 'content' : 'main'}

{block $main_block}

Screenshot

I believe this worked fine before Latte version 2.4. If I set the block name as a string, there is no such issue.

Do I need to make things differently or is it a bug?

Last edited by tpr (2016-07-04 13:20)

2 years ago

greeny
Member | 406
+
0
-

Try looking to source, not to devtools (source is Ctrl+U on Chrome i believe). This looks more like added by some javascript.

2 years ago

tpr
Member | 55
+
0
-

Thanks but no, it's there even without JS (and in the page source). That was the first thing I checked.

Here is another page where I just set the block name to a variable like this:

http://mosolygo.paqartdesign.com/…-1-szazalek/

{var $block_name = 'content'}

{block $block_name}

The issue is also present if I set the variable outside from the latte file (in “presenter” but as I wrote I'm using the standalone version of Latte).

2 years ago

David Matějka
Moderator | 5701
+
+1
-

It's a bug. I will send a fix.

edit: done https://github.com/…tte/pull/125 :)

2 years ago

tpr
Member | 55
+
0
-

Just checked and works fine, thanks!