Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32831 > unrolled thread

stringtemplate and STGroup

Started bysessantaquattrobits@gmail.com
First post2015-10-08 03:17 -0700
Last post2015-10-08 03:17 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer


Contents

  stringtemplate and STGroup sessantaquattrobits@gmail.com - 2015-10-08 03:17 -0700

#32831 — stringtemplate and STGroup

Fromsessantaquattrobits@gmail.com
Date2015-10-08 03:17 -0700
Subjectstringtemplate and STGroup
Message-ID<f78fab30-3f41-4dec-9f34-10d31f2d1261@googlegroups.com>
To make a long story short:
where can i find a tutorial about stringtemplate and STGroup ?
Google and su www.stringtemplate.org hasn't been an help, for me :(

A more specific questios is:
how can I use an STG with multiple attributes/substitutions ?

I succeeded in this:

templName(param) ::= <<$param:{param | $\n$$\t$<td><a href='link'>$param$</a></td>}$ >>
corresponding java is:
final STGroup stGroup = new STGroupFile("templates/exampleTemplateTD1.stg",'$','$');
final ST templName = stGroup.getInstanceOf("templName");
templName.add("param", Arrays.asList(new String[]{"descr1", "descr2", "descr3"}));

I would like to substitute also the "link"
Many efforts leaded me to the unsatisfying:

templName(param,link) ::= <<
$param:{param | $\n$$\t$<td><a href='$link:{link|$link$}$' >$param$</a></td>}$ >>
java is:
final STGroup stGroup = new STGroupFile("templates/exampleTemplateTD1.stg",'$','$');
final ST templName = stGroup.getInstanceOf("templName");
templName.add("param", Arrays.asList(new String[]{"descr1", "descr2", "descr3"}));
templName.add("link", Arrays.asList(new String[]{"link1", "link2", "link3"}));

the poor output is:
<td><a href='link1link2link3' >descr1</a></td>
<td><a href='link1link2link3' >descr2</a></td>
<td><a href='link1link2link3' >descr3</a></td> 

TIA to who could find the time and patience to help me!

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web