Well I did steal this from zxc on github...
https://github.com/Pogs/mustache.luaIt's mostly the same as what he wrote, I just changed a few things like converting a few loops to make use of gsub. I sort of gave up on it (though I trust it), as I fell out of love with mustache. The only things missing are partials and the ability to change delimiters. I added the extension:
{{?section}}printed only once, even if list{{/section}}
Templating is a fun topic to be sure :-)
PS: I never saw the point of having partial templates because I never needed them, I'm sure to large codebases it would make sense. I just didn't put in the work to add that. I also gave up on changing delimiters because of how I'd need to break the gsub() loop to reparse with the new delimiter. Perhaps there is an easy solution to that, but I never needed other delimiters so I didn't do that either... (I'm selfish)
PPS: Here's what I did beyond zxc's work:
https://github.com/Pogs/mustache.lua/commits/master