twolfson / reverse-mustache

Reverse templating library for mustache, generating variables from a template's output
The Unlicense
30 stars 6 forks source link

Reusing variables in conditionals leads to wrong reversal #6

Open adrianheine opened 7 years ago

adrianheine commented 7 years ago

The following test case fails behavioral sanity check:

  template: 'hello {{place}} {{locator}}, {{#locator}}{{place}}{{/locator}}!',
  content: 'hello world in universe, world!'
twolfson commented 7 years ago

I think the implementation was quite buggy due to this being written quickly =/ Mentioned in README:

https://github.com/twolfson/reverse-mustache/tree/1.7.0#documentation

It might be best to start fresh

That being said, I think this is being caused by {{#locator}} acting like a with statement so it's trying to set up a locator.place value. It also could be related to #4