TryGhost/express-hbs

Support for alternative handlebars delimiters

mark-lester opened this issue · 0 comments

I am implementing a scheme of 3 phase template execution, these being

  1. Once. First time only for a given locale (typically to resolve translations)
  2. Every. At deliver time, classic CGI page production
  3. Client. Client side

In order to have all three potentially in the same file, I am using {% for first/once election, {@ for delivery time, and {{ for usage in the client. For server time delivery I need support for asynchronous helpers, which you have.
So you can go

{%#__ "something to translate" %}

to call the __ translation helper in the "once" phase. I will implement something like {""something to translate""}
I also want to be able to go

{@#__ a_variable_to translate @}

and actually pass data through the translator (e.g. football team names), so I need asynchronous for that as I want to write dynamically into the dictionary.

The first phase saves the output from executing the {% stuff in <filename> for <> in .foxbat/<>/<>
I just need tp overload render to do that then call render with the permuted filename.

There is a handlebars-delimiter package to do this, I will implement and report back. I guess the neatest way would be to just overload the constructor to allow handlebars to be passed to it.