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

How to generate $ (dollar) sign through string template

My goal is to generate code for html file using string template. html file contains some ajax code where we need dollar sign. I am not able to print $ dollar sign using string template file, as $ dollar sign denotes EOF in string template. code for…
abc
  • 190
  • 1
  • 4
  • 16
0
votes
1 answer

Problems rendering properties of model objects passed to template

I'm a StringTemplate newbie with a really basic. I'm trying to utilize this to send automated emails. I've read as much as I can to digest what is out there. I'm starting with a simple test case and having trouble getting properties of objects to…
0
votes
1 answer

stringtemplate4 Getting "Anonymous()" as output

Trying to figure out what I'm doing wrong here. public String getSysJobTempl(String JobID, String SysID, String JobCode, String SchedID) { String finalString= ""; ST sysJob = new ST("INSERT INTO system_job…
seerick
  • 31
  • 8
0
votes
1 answer

Accessing string template rule names from ANTLR base listener

Working on a pretty printer. Based on my understanding of ANTLR and StringTemplate so far, if I want to match all my grammar rules to templates and apply the template each time the grammar rule is invoked, I can create my templates with names…
Shelby S.
  • 157
  • 1
  • 5
  • 16
0
votes
1 answer

Using GUIDs as attributes to substitute in a stringtemplate.org template

Is there a way in template (stringtemplate.org 4 engine) to use a GUID as an attribute to be substituted or to reduce stringtemplate's expressiveness so it will not evaluate the value between the delimiters as anything other than an attribute…
Frederik
  • 2,921
  • 1
  • 17
  • 26
0
votes
2 answers

How do I load StringTemplateGroup files from a jar file?

What is the best practice for including template group files in a jar? I would like to include my StringTemplateGroup file in my executable jar. I'm using Eclipse and have put the template group file in a folder called "template" under the project.…
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
2 answers

Why do I get a NullPointerException with seemingly simple StringTemplate code?

I'd like to use StringTemplate 4 to render views in my Google App Engine app. In my Controller (I'm using Slim3 MVC framework if it matters), I have this code: STGroup group = new STGroupDir("templates/default",'$','$'); ST stPage =…
JR Lawhorne
  • 3,192
  • 4
  • 31
  • 41
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

Generating and consuming an array within a StringTemplate-4 template

I'm new to StringTemplate4 and probably I am going to ask something overly simple, impossible or stupid but I couldn't find any other information on it. So far, I have set this minimal set of templates: define(name,arity) ::=…
Stefano Bragaglia
  • 622
  • 1
  • 8
  • 25
0
votes
1 answer

How do I load StringTemplates from the resource package?

I have the following package structure src/main/resources/shiro/definitions I'd like to load the .st files from the resources package. I can't figure out how to get the right file path for this folder. I'd like to do something like (snippet from…
Jeffrey Guenther
  • 871
  • 10
  • 27
0
votes
1 answer

Although STParser.g exists where is STParser.java and the like?

I am working on a Delphi version of StringTemplate 4. To do that I need access to all the Java source files. I downloaded the Java source on 19 Nov 2013. In the file Compiler.java in the folder Compiler is the routine :- /** Compile full template…
0
votes
1 answer

Can a stringtemplate ModelAdaptor fall back to default stringtemplate property evaluation?

It appears that, if I supply a ModelAdaptor for a class I supply to stringtemplate, then I have to respond to every property I want accessible in a template. I'd like to be able to be able to implement getProperty for properties that don't follow…
Mike Cargal
  • 6,610
  • 3
  • 21
  • 27
0
votes
2 answers

External use of OutputModelFactory, @ModelElement, etc. in code generation from ANTLR parseTree

I'm looking at how best to use StringTemplate for code generation for a compiler using ANTLR as the parser. I decided to look to the ANTLR source for inspiration on how to leverage StringTemplate. Since this code is part of the ANTLR tool, rather…
Mike Cargal
  • 6,610
  • 3
  • 21
  • 27
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