Questions tagged [stringtemplate-4]

StringTemplate is a java template engine

StringTemplate is a java template engine (with ports for C#, Python) for generating source code, web pages, emails, or any other formatted text output. StringTemplate is particularly good at code generators, multiple site skins, and internationalization / localization. StringTemplate also generates this website and powers ANTLR.

137 questions
0
votes
1 answer

Template application default parameter

I'll try to make my problem seem simple, hoping that the solution will be. Let's state that we have two templates as following : html(data,value,charts) ::= << [...] var $data$ = $value$; $charts$ …
Yohannan
  • 1
  • 1
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
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

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

connecting stringtemplate4 - antlr4 - java tesrig

I am new in antlr. Translating code using ST through antlr v3 is good taste. I also see Jason2xml translation in parr book, but still confuse. How do i use or connecting ST-4 in antlr or java-test rig. Any tutorial or example like antlr-ST v3 ??
0
votes
2 answers

StringTemplate4 if conditional with length

I need to generate the following kinds of code with StringTemplate4: methodFoo0(Connection conn); methodFoo1(Connection conn, int arg1); methodFoo2(Connection conn, int arg1, int arg2); etc. The "Connection conn" part is always present so I am…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
0
votes
1 answer

Generating really big Java code

I need to populate ~20k built-in function and constants from an CHM file into a List. First I tried to serialize a list of them, but deserialization takes 1500ms (too long for a quick code-completion, even at the first hit). Tried code generation…
0
votes
0 answers

Emacs mode for StringTemplate

Is there an Emacs mode available for the StringTemplate Java template engine ?
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
0
votes
1 answer

Getting the length of a String value in StringTemplate

According to the documentation you can reference properties of objects in the format. I was hoping this would let me check the length of a String, but it doesn't seem to work. I think this is because the method is String.length(),…
DaoWen
  • 32,589
  • 6
  • 74
  • 101
0
votes
1 answer

I couldn't find the v3 API setAttributes(Object) in v4

v4 provides an API: ST.add(String, Object). I couldn't find the v3 API setAttributes(Object) in v4. I used ST.add("root", JSONObject). An exception occures: java.lang.IllegalArgumentException: no such attribute: root at…
0
votes
1 answer

ANTLR - StringTemplate - CamelCase

What is the best pattern (language independent, for retargetable generation code) to translate antlr token to camel case StringTemplate attribute in a tree conversion? Example: My DSL has MY_FIELD definition and in the StringTemplate output I need…
0
votes
0 answers

StringTemplate 4 NullPointerException

I 've got NullPointerException java.lang.NullPointerException at org.stringtemplate.v4.STGroup.loadTemplateFile(STGroup.java:663) at org.stringtemplate.v4.STGroupDir.loadTemplateFile(STGroupDir.java:176) at…
khavrenko
  • 1
  • 1
0
votes
0 answers

Update Maven Repo

Can you update http://mvnrepository.com/artifact/org.antlr/ST4 ? The latest version there is 4.0.4 and you all are on 4.0.6. FYI: the ONLY reason I am asking this here in SO is due to this page: http://www.stringtemplate.org/support.html which…
JoeG
  • 7,191
  • 10
  • 60
  • 105
0
votes
1 answer

StringTemplate-4: Cannot render expr property

According to the StringTemplate 4 wiki, I should be able to display an expr property, but I cannot. I'm using StringTemplate4 with jython. Here's my template file, test.st: test(persons, person) ::= << …
MD6380
  • 1,007
  • 4
  • 13
  • 26
1 2 3
9
10