Closed dswitzer closed 12 years ago
Dude! Nice one!
Hmm, I'm testing this I'm getting test failures for the whitespace head and tail tests when using the custom tag version that Tony pulled in this morning. I'll see if its something I did incorrectly.
Never mind! As soon as I posted it I saw my mistake. I was doing some overzealous trimming. If Tony pulls in your changes, I'll submit a pull request to fix my bugs. Great mods by the way!
you all rock!
I've got some minor performance enhancements coming down the pipe as well :) Will merge them into this work shortly.
I wanted to pass back some of the mods I've been making to the Mustache.cfc. We needed support for dot notation (which is now part of the spec) so I added support for it.
I also wanted better whitespace management, that worked closer to what the other Mustache implementation I've seen. This version doesn't produce blank lines for blocks that aren't executed or during array/query segments between each line.
I also added an example (MustacheFormatter) on how you could extend the language to do additional render logic. In this example, I've implemented a Ctemplate-style formatter.
Using the MustacheFormatter version of the CFC, you could do something like:
{{name:upperCase()}}
To format the "name" variable so it's all in upper case.
I have some additional code re-arrangement I'm planning (I'm going to move all the variables into a "Mustache" namespace--that way it doesn't collide with other variables when your extending the base Mustache.cfc,) but I wanted to get you these changes before I changed it too much more.