I'm trying to write a docpad plugin that exposes email-obfuscation functions.
At the moment I have this:
extendTemplateData: ({templateData}) ->
templateData.obfuscate = (emailAddress) ->
return ### obfuscated ### emailAddress
Great, I can now use <%- @obfuscate(mail) %>
in my eco templates.
But, what I would like to do is something like this
docpadConfig:
templateData:
emailAddresses:
support: obfuscate("[email protected]")
So I can write <%- @emailAddresses.support %>
I would also be ok with:
support: -> return obfuscate("[email protected]")
So the question is: how can I make the obfuscate function available in that spot?
I've also tried to access it through docpadConfig.templateData.obfuscate()
with no luck.
You are close! You can get the plugin
templateData
like this: