1

I'm looking at the source code for a Rails application that uses Backbone and there are template files with .jst.ejs extensions.

The templates include HTML with lines of JavaScript wrapped in double-square-brackets like this this example:

[[ if (currentUser) { ]]
 <h1>Welcome, back!</h1>
[[ } else { ]]
 <h1>Please sign up!</h1>
[[ } ]]

What is the name of this template syntax?

David
2551 silver badge14 bronze badges
asked Jul 27, 2015 at 0:11
1
  • I found out that the template engine is EJS and the app in question had modified the default syntax to use square brackets instead of the typical <% ... %> syntax. Commented Aug 4, 2015 at 7:07

1 Answer 1

1

I'm not sure if many template syntaxes have a specific name. A lot of template syntaxes are unique, but there are frameworks out there that use similar templating syntaxes without actually calling them anything. Mostly, they are referred to by the name of the engine.

For example, both Twig (a templating engine that can be used with the Symfony Framework for PHP) and AngularJS (a javascript Framework) have ways of binding by means of the {{ }} syntax. A code sample could be said to be using a Twig-like or Angular-like syntax, but as far as I know there are very few templating syntaxes out there that are standardized and implemented in different engines and can therefore be 'named'.

answered Jul 27, 2015 at 7:00
3
  • To follow up on that info, does it make sense to ask what templating engine utilizes the [[ ]] syntax? Commented Jul 28, 2015 at 0:17
  • Would be more appropriate for stackoverflow I think, but go ahead. Might be a custom thing though. The extension of the file could put you in the right direction, is stackoverflow.com/questions/6557238/… any help? Commented Jul 28, 2015 at 7:10
  • I've found that question, too. I've only seen references to the <% ... %> syntax, not [[ ... ]] syntax. Commented Jul 28, 2015 at 18:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.