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
0
votes
1 answer

StringTemplate V4 ''->" syntax

Newbie (or silly) question: I'm trying to use StringTemplate V4 to convert a language to another one, like C to nuSMV. So far I noticed that I have to "instrumentate" my grammar file (g4) to inform what I'm supposed to replace. For instance: atom …
0
votes
4 answers

iterate through list in StringTemplate

I have a map in Java Map model = new HashMap<>(); Each (key,value) pair of this map is a list of urls: List thumbnailImgUrl = new ArrayList<>(); for (....) { thumbnailUrl.add(url); } model.put("photoUrl",…
hari shankar
  • 27
  • 1
  • 7
0
votes
1 answer

How to get gap-name list from an anonymous StringTemplate (v4) before adding any attributes?

I'm attempting to use StringTemplate.v4 for simplistic templates, meaning only simple gaps names like %body%--I'm not using any other features, such as if-logic, sub-templates, or expressions. (To be honest, it's API is poorly documented, and at…
aliteralmind
  • 19,847
  • 17
  • 77
  • 108
0
votes
1 answer

How can I organize a large number of Stringtemplate files into different folders

In my project, I am using StringTemplate files to generate java code extensively. I am keeping all StringTemplate files in one folder. Now, I want to group StringTemplate files according to their category into different folders. I am using the…
user-517752
  • 1,188
  • 5
  • 21
  • 54
0
votes
0 answers

Dependency for String template in Apache Camel for fuse server Causes Class Cast Exception

I am using string template to generate html text and send it mail as attachement.
0
votes
2 answers

StringTemplate C# override array behaviour

I'm using StringTemplate4 to allow users to pass an HTML template and page ID to a web service, then get the parsed result. The name and number of fields is dynamic, meaning that while some pages might return only one value for a given field, other…
Maloric
  • 5,525
  • 3
  • 31
  • 46
0
votes
1 answer

String Template throws null pointer exception

Using Camel String Template endpoint, I am trying to loop nested collection as follows Endpoint : Template : $body: {coparnHeader|
0
votes
1 answer

Improve StringTemplate 4 performance

I'm using StringTemplate 4 to internally generate web pages in an Android application. The templates used in my application server (for web access) are also used to generate pages internally in the Android application, this combined with a json data…
Nulleye
  • 25
  • 1
  • 6
0
votes
2 answers

Using css in a StringTemplate Email

I'm currently using StringTemplate to create my emails on the fly and its proven very easy to use in creation of the email. However, I'm trying to apply some styling to my emails and dont seem able to do this in the normal manner. I can style parts…
Gerard
  • 4,818
  • 5
  • 51
  • 80
0
votes
1 answer

"x of n" in StringTemplate from a single int/count

I'm trying to print out generate shipping labels, and I know how many I want. So given that I know n, how do I print "x of n" for x=1 to n? What I'm wanting to do is have an expansion template that will take n and provide the x and n variables to…
Stephen
  • 19,488
  • 10
  • 62
  • 83
0
votes
1 answer

Is it possible to make a custom renderer for StringTemplate without using STGroup's?

I'm trying to use StringTemplate to be able to parse some configuration file inputs, and was wondering if it was possible to register a renderer without using STGroup. Example (but the registerRenderer method seems to be missing from the…
Burg
  • 1,988
  • 1
  • 18
  • 22
0
votes
1 answer

perform iteration in StringTemplate4 (C#)

In the StringTemplate4 cheat sheet (http://www.antlr.org/wiki/display/ST/StringTemplate+cheat+sheet), it mentions that to perform an iteration Apply an anonymous template to each element of attribute. The iterated…
Karl Cassar
  • 6,043
  • 10
  • 47
  • 84
0
votes
1 answer

StringTemplate use of listItem

I'm trying to get the simple example to work, here is the sample code .stg file group list-demo; htmListExample(xmen) ::= << Example 5:

Original X-Men

    $xmen:listItem()$
user2635921
  • 75
  • 1
  • 5
0
votes
1 answer

StringTemplate 4 doesn't seem to work

I've only been using StringTemplate 4 for a week, so it's probably something I'm doing, but I don't seem to be able to make the work. I'm using 4.02 (since that's the latest in Maven repository). I have a class called Variable. This is a…
0
votes
1 answer

How to insert a string template into another string template ST 4.0

Im just starting to learn string template and ive come across the example shown here: group simple; vardef(type,name) ::= " ;" method(type,name,args) ::= << () {
Har
  • 3,727
  • 10
  • 41
  • 75