twitter / hogan.js

A compiler for the Mustache templating language
http://twitter.github.io/hogan.js
Apache License 2.0
5.14k stars 431 forks source link

Multi-level inheritance breaks with compiled templates #161

Closed dtb closed 10 years ago

dtb commented 10 years ago

I was playing around with template inheritance, and found that if I compile the “parent” templates, multi-level inheritance breaks.

When I render 2 different child templates that use the same parents, the second template will output the same thing as the first one, when it shouldn't. I created a test case based on the existing tests, here: https://gist.github.com/dtb/8849297.

I found that if I clear the cache (Hogan.cache = []) between tests, the tests pass.

dtb commented 10 years ago

@nemtsov any chance you could take a look at this? It seems like you might be familiar with the multi-level inheritance stuff. As far as I could tell, this doesn't happen with single-level inheritance.

nemtsov commented 10 years ago

@dtb absolutely. I'll take a look this weekend.

nemtsov commented 10 years ago

@dtb give my PR a try when you get a chance please.

dtb commented 10 years ago

@nemtsov thanks a lot! I just tried again and #162 seems to fix it. Hope we can get this merged in.