tbranyen / combyne

A template engine that works the way you expect.
MIT License
144 stars 19 forks source link

Allow nested objects for variables. #36

Closed carldanley closed 10 years ago

carldanley commented 10 years ago

I noticed that I cannot access variables like one.two.three for some reason. I was trying to iterate over something like page.scripts.header and it didn't work.

carldanley commented 10 years ago

Given the object:

{
    header: {
        scripts: [ 'header.js' ],
        css: [ 'header.css' ]
    },
    footer: {
        scripts: [ 'footer.js' ]
    },
    page: {
        name: 'testing',
        title: 'title'
    }
}

and this iteration:

{%each header.css as css%}
    <link rel="stylesheet" type="text/css" href="{{css}}">
{%endeach%}

I receive an output of http://cl.ly/image/3E3N3R3a063B. It appears to not maintain the depth when iterating.

tbranyen commented 10 years ago

I've updated the tree builder to allow for nested properties, in 69d2604, can you try this and let me know if it's fixed?

tbranyen commented 10 years ago

Feel free to reopen if the problem persists.