Markup.js
Markup.js copied to clipboard
Hyperpotamus
Hi there, I'm using Markup.js for a rather non-standard opportunity. I evaluated all of the templating engines that I could find and this one fit my needs perfectly, with the addition of a few small missing features. I am using this as part of my hyperpotamus web-scripting/automation engine.
I started with the feature that @csetea submitted in #28 and then added some extra parameters to his callback to allow for more flexible handling in the consumer.
Then I added support for changing the template delimiters from {{ }}
. In my case, I needed to use <% %>
and so they are now overridable. I wrote tests for those.
Then I wanted to use your excellent path traversal mechanism for a case where I need to allow users to retrieve the value of an object at the given path. I added the ability for a "!" prefix to be added immediately after the opening delimiter. When this is present, the result is not stringified, but instead returned as-is.
I noticed that some of the .js files were missing from the package.json definition, so I added those (but that may have been a mistake on my part).
Thought I might also include a link to the project that is using this: https://github.com/pmarkert/hyperpotamus (not merged into master yet, so view https://github.com/pmarkert/hyperpotamus/commit/fbbd45691d2befdb86fd2675367f27079fef811d for the usage)
and a specific wiki page that mentions Markup.js and some of the modifications: https://github.com/pmarkert/hyperpotamus/wiki/Interpolation.
Thanks for the nice feedback! I don't actively work on Markup.js anymore, but I'll review this at the earliest opportunity and see if it makes sense to pull into the lib, either in whole or in part. --Adam