laktek / punch

A fun and easy way to build modern websites
http://laktek.github.com/punch
MIT License
1.17k stars 107 forks source link

Block helper dosen't work with mustache template #106

Open kanonji opened 10 years ago

kanonji commented 10 years ago

Tag helper works, but block helper doesn't work.

What I did 1.

To make sure, I did punch setup foo; punch s aside from my working project and opend in a browser.

a part of _header.mustache

<header>
    <h1>{{#upcase}}{{site-title}}{{/upcase}}</h1>

    <ul class="navbar">
    {{#navbar}}
        <li><a href="{{{href}}}">{{label}}</a>
    {{/navbar}}
    </ul>
</header>

a part of HTML rendered

<header>
    <h1></h1>

    <ul class="navbar">
    </ul>
</header>

What I did 2.

I have used https://github.com/laktek/punch-current-page-helper in my project has also the broblem. When I added console.log(text) before https://github.com/laktek/punch-current-page-helper/blob/05160af5231291468c80052076d68c46502e810d/lib/current_page_helper.js#L17 , I got empty in text.

I tried to figure out the cause by reading the sourcecode. Because caller of the helpers seems in mustache.js, I gave up and switch template engine to punch-engine-handlebars. Block helper works with punch-engine-handlebars. I'm not sure this problem is just on me or not.

My env.

Env version
node v0.11.9
npm 1.3.15
punch 0.5.40
mustache 0.8.0
OS Mac OS X Lion
laktek commented 10 years ago

This seems to be a bug originated with Mustache.js 0.8.0, for now I reverted the dependency to Mustache.js 0.7.3 95b1044e3f023d6.

This change should be reflected from Punch versions 0.5.43.