Questions tagged [stringtemplate]

A templating language which strictly enforces model/view separation

StringTemplate is a Java based templating language (with ports in Python, C#, Ruby, Scala) that strictly enforces model/view separation. See the whitepaper for more details.

264 questions
32
votes
2 answers

What are the main differences between StringTemplate and FreeMarker?

The net seems to be full of comparisons between Velocity and FreeMarker, and they seem to be reasonably equivalent. But there seems to be almost no comparisons between StringTemplate and FreeMarker! So, what are the main differences between…
Nakedible
  • 4,067
  • 7
  • 34
  • 40
22
votes
1 answer

Example of subclassing string.Template in Python?

I haven't been able to find a good example of subclassing string.Template in Python, even though I've seen multiple references to doing so in documentation. Are there any examples of this on the web? I want to change the $ to be a different…
Josh Gibson
  • 21,808
  • 28
  • 67
  • 63
17
votes
5 answers

Which Java MVC frameworks integrate easily with StringTemplate?

It's hard to see how StringTemplate integrates easily (or not) with popular Java web MVC frameworks. Which Java MVC frameworks integrate easily with StringTemplate? A good answer: mentions one solution to integrate with a framework, includes a link…
Daniel Jomphe
  • 16,991
  • 5
  • 29
  • 30
17
votes
14 answers

JQuery's $ is in conflict with that of StringTemplate.Net in ASP.Net MVC

I am exploring ASP.NET MVC and I wanted to add jQuery to make the site interactive. I used StringTemplate, ported to .Net, as my template engine to generate html and to send JSON. However, when I view the page, I could not see it. After debugging,…
OnesimusUnbound
  • 2,886
  • 3
  • 30
  • 40
13
votes
3 answers

Putting { in verbatim string with C#

Possible Duplicate: How to escape brackets in a format string in .Net How do I put { or } in verbatim string in C#? using System; class DoFile { static void Main(string[] args) { string templateString = @" \{{0}\} …
prosseek
  • 182,215
  • 215
  • 566
  • 871
13
votes
7 answers

Putting \" in verbatim string with C#

I need to print a "b" c with the vebatim string, I posed another question about multiple line code template here. I tried with verbatim string as follows : using System; class DoFile { static void Main(string[] args) { string…
prosseek
  • 182,215
  • 215
  • 566
  • 871
12
votes
2 answers

StringTemplate - How to iterate through list of business objects and output simple html?

I've just started using StringTemplate in my C# project. I went through the documentation, but I can't seem to find a way to implement this simple scenario: I have a list of simple business objects (let's say Orders) and I want them displayed inside…
Alt_Doru
  • 335
  • 4
  • 13
9
votes
3 answers

StringTemplate invalid character '<' when reading XML Template

I am trying to create a simple XML-Template which so far only consists of: I read the file like this: STGroup group = new STGroupDir("templates"); ST st = group.getInstanceOf("report"); st.add("analysis", ana); …
er4z0r
  • 4,711
  • 8
  • 42
  • 62
8
votes
2 answers

How can I iterate over the keys and values of a String Template 4 Map?

In StringTemplate 4, the default behavior for iteration is to iterate over the keys instead of the values, which was the behavior in version 3. I can not find the syntax for how to iterate over the keys and values at the same time for version 4. Can…
user177800
8
votes
2 answers

Better template language needed

Yes, I know that this has been asked before. But most of the questions were two years ago, and there's got to be a better answer today. I need a template language for rendering HTML. Requirements: Must be callable from Java. Must not be Freemarker,…
ccleve
  • 15,239
  • 27
  • 91
  • 157
7
votes
3 answers

StringTemplate remove < > as delimiters

I am trying to use StringTemplate in a java web app to generate html emails. When trying to enter line breaks, I use \ This does not seem to be working. \ is not working as well. Is there a way to turn off < and > as delimiters so I can…
Lumpy
  • 3,632
  • 4
  • 34
  • 58
7
votes
4 answers

Format date in String Template email

I'm creating an email using String Template but when I print out a date, it prints out the full date (eg. Wed Apr 28 10:51:37 BST 2010). I'd like to print it out in the format dd/mm/yyyy but don't know how to format this in the .st file. I can't…
Gerard
  • 4,818
  • 5
  • 51
  • 80
7
votes
2 answers

Nested loop in StringTemplate

Im interested in writting something similar to a nested loop using StringTemplate template engine. In C# have a HashTable of which each Key contains List of Document objects, each Document has a title and source. I would like to list at the…
Benjamin Ortuzar
  • 7,801
  • 6
  • 41
  • 46
6
votes
1 answer

Using StringTemplate together with forms in SpringMVC

does anyone know how to use StringTemplate with forms in SpringMVC framework? Any tips, tutorials...?
Jarek
  • 7,425
  • 15
  • 62
  • 89
6
votes
2 answers

Stringtemplate compare strings does not work

Can someone explain why this does not work ? StringTemplate query = new StringTemplate("hello " + "$if(param==\"val1\")$" + " it works! " + "$endif$ " + "world"); …
Alexey
  • 517
  • 2
  • 10
  • 21
1
2 3
17 18