edwindj / whisker

{{mustache}} for R
https://mustache.github.io
213 stars 19 forks source link

Check for missing variables within renderTemplate, to achieve #17

Closed danhalligan closed 7 years ago

danhalligan commented 10 years ago

Hi edwindj,

I've attempted a fix at the bug request I posted where we'd like an options to check all variables in the template. I think this works with the trivial example I posted in the bug request, but could be tested more thoroughly. It works by performing the check within renderTemplate, so this function needs to have the parameter "keys" for reporting the warning and needs the parameter "checkvars" to know if it should check or not. The value for checkvars is passed through all enclosing functions neatly using ellipsis arguments.

Note, this is my first fork/pull request on github, so if anything looks odd let me know! Also I did the modifications in the checkvars as well - not sure if this is best?

Dan

edwindj commented 10 years ago

Thanks! I will look into your code tomorrow,

Best regards,

Edwin

danhalligan commented 10 years ago

I also added an option in a second commit to disable escaping of html characters which I find useful...

danhalligan commented 10 years ago

OK I just noticed you can use triple curly brackets to disable html escaping! So, you might want to ignore the last commit. However, I think an option like this is very useful if, for example, you wanted to use the same template to render text for html and latex, or wanted to otherwise globally disable escaping of html characters.

danhalligan commented 8 years ago

Hi - just wondering if you ever made any progress with this feature (check for missing variables within renderTemplate)? It would be great to see this feature in the master branch. Cheers!

edwindj commented 8 years ago

Thanks for asking! I will look into it this week and let you know.

danhalligan commented 7 years ago

Hi, I just thought I'd check in about this pull request again. Looking back, I think its been sitting >2 years now so I'm wondering if we can consider this package as still under development? If you need any help, let me know.