Questions tagged [templating-engine]

A templating engine processes templates in a given language, often binding them to a data source, in order to produce an output document.

templating-engine is a software designed for processing web templates, filling them with data and producing web documents.

See wikipedia article.

Also see:

128 questions
385
votes
9 answers

What are the differences between Mustache.js and Handlebars.js?

Major differences I've seen are: Handlebars adds #if, #unless, #with, and #each Handlebars adds helpers Handlebars templates are compiled (Mustache can be too) Handlebars supports paths Allows use of {{this}} in blocks (which outputs the current…
Chad Johnson
  • 21,215
  • 34
  • 109
  • 207
272
votes
5 answers

How to output loop.counter in python jinja template?

I want to be able to output the current loop iteration to my template. According to the docs, there is a loop.counter variable that I am trying to use:
    {% for user in userlist %}
  • {{ user }} {{loop.counter}}
  • {% if…
Rolando
  • 58,640
  • 98
  • 266
  • 407
56
votes
15 answers

Can you recommend a .net template engine?

I am looking for a .net templating engine - something simple, lightweight, stable with not too many dependencies. All I need it for at the moment is creating templated plain text and html emails. Can anyone give me a good recommendation? If it…
serg10
  • 31,923
  • 16
  • 73
  • 94
21
votes
8 answers

Any advances on John Resig's "JavaScript Micro-Templating"?

So I've seen this post on JavaScript Micro-Templating by John Resig and I have a need for a micro-templating engine like this. But he saids in the post that he'll keep a more-refined version in his Secrets of the JavaScript ninja book and also…
chakrit
  • 61,017
  • 25
  • 133
  • 162
13
votes
2 answers

Pass JavaScript object/hash to Handlebars helper?

Is it possible to pass a JavaScript object/hash into a Handlebars helper call? I'd like to do something like this: {{#textField {'id':'text_field_1', 'class':'some-class', size:30} }}{{/textField}}

Help text…

Chad Johnson
  • 21,215
  • 34
  • 109
  • 207
10
votes
1 answer

What are the main differences between HAML, SASS/Compass and ERB?

I'm looking for a templating engine. What are the important factors to consider when choosing among HAML, SASS/Compass and ERB?
Yen
  • 2,176
  • 3
  • 19
  • 27
10
votes
4 answers

How to indent content of included template

I am using go templates to create yaml definitions for kubernetes. I am trying to nest templates but run into issues where I can't re-use a definition simply because the indention is wrong when included. I.e., in one case the contents need…
dirtbikejunkie
  • 471
  • 1
  • 5
  • 5
8
votes
2 answers

MEAN stack - reliance on templating (Angular vs Templating Engines)?

This may come from a lack of experience on the various sections of the MEAN stack, but from the various boilerplates I've seen (mean.io, hackathon-starter, etc.) in the app.js code, there is always a call to using jade templating engine. I know that…
Robert
  • 1,745
  • 5
  • 34
  • 61
7
votes
3 answers

JS templating system with Backbone.js

I am looking at some good templating systems to be used alongwith an MVC framework like Backbone.js I am aware of one such system (jQuery Templating). However, the same has been discontinued for some reasons and hence I am looking at some other good…
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
7
votes
3 answers

Twitter typeahead.js: Possible to use Angular JS as template engine? If not how do I replace "{{}}" for Hogan/Mustache js?

I am working with twitter's typeahead.js and I was wondering if it was possible to modify hogan.js to use something other than {{}}? I am looking at the minified code now and I have no idea what to change for something so simple. Doing a find and…
meiryo
  • 11,157
  • 14
  • 47
  • 52
5
votes
2 answers

Fatal error: Uncaught Error: Class 'Twig_Autoloader' not found

Recently I installed Twig2.0 via Composer for PHP7.2 and when running the code I'm getting these errors, ( ! ) Fatal error: Uncaught Error: Class 'Twig_Autoloader' not found in C:\wamp64\www\php-twig\example.php on line 4 ( ! ) Error: Class…
Sumithran
  • 6,217
  • 4
  • 40
  • 54
5
votes
1 answer

Repeat string multiple times in Jekyll

How do you repeat string multiple times in Jekyll? For eg: in Python, you can do "hello" * 5 to get 'hellohellohellohellohello'. In Jekyll is there an easier way of doing the same thing than this. {% for i in (1..5) %} Hello {% endfor…
Ishan
  • 3,931
  • 11
  • 37
  • 59
5
votes
1 answer

Freemarker page break

I'm using Apache freemarker to construct PDF document reports. I have a situation when half of my page is full of text and I need to add a table below it. Table size is dynamic and sometime it fits in the same page with the text and sometimes not,…
Tomas
  • 1,212
  • 4
  • 15
  • 26
5
votes
2 answers

How to create a custom Twig function class, without using a static method?

I can create a Twig extension for my project like this class Functions extends Twig_Extension{ public function getName(){return 'foobar';} public function getFunctions() { return array( 'loremipsum' => new…
SkaveRat
  • 2,124
  • 3
  • 18
  • 34
4
votes
4 answers

Can any Java based templating engine work with Websphere Commerce?

I'm a UX developer at a retail company, we use Websphere Commerce for our e-com sites. The app dev guys are in complete control of the HTML output we have to file bugs with them to get something as simple as an ID changed in HTML. HTML and front end…
belshire
  • 51
  • 4
1
2 3
8 9