bminer / node-blade

Blade - HTML Template Compiler, inspired by Jade & Haml
Other
320 stars 28 forks source link

Meteor: need to generate unique branch labels for file includes within loop structures #157

Closed bminer closed 7 years ago

bminer commented 11 years ago

Right now, the only way to ensure that Blade is properly generating branch labels is when using the foreach loop structure. That is, file includes within a foreach loop work just fine.

Regular for loops, while loops, etc. do not work as desired.

zeroasterisk commented 11 years ago

+1

same for _.map() -- at least from within Template helpers

bminer commented 11 years ago

What about just adding a branchLabel keyword to Blade?

Usage:

- for(var i = 0; i < arr.length; i++)
    branchLabel arr[i].id
        p Item #{arr[i].id}: #{JSON.stringify(arr[i])}

The trick here is that every element in the array must have a unique identifier.

Or, for file includes (the main purpose of this issue):

- for(var i = 0; i < arr.length; i++)
    branchLabel arr[i].id
        - var item = arr[i]
        include "child_template" exposing item

I wonder if this would work, too....

- for(var i = 0; i < arr.length; i++)
    branchLabel i
        - var item = arr[i]
        include "child_template" exposing item

Hmm... interesting...

bminer commented 11 years ago

Hey everyone who is interested. I haven't forgotten about this issue. It's just that Meteor & Spark have been changing quite a bit lately, and I think that I would rather wait for everything to become a bit more finalized before investing much more time in it. Thanks for you patience!

bminer commented 7 years ago

Closing this issue. Dropping Blade + Meteor support for now. :(