Comments (6)
try field not field=field
from stringtemplate4.
That works.
Similarly
auxMap ::= [
"E": "electric <field>",
"I": "in <field> between",
"F": "<field> force",
default: "<field>"
]
makeTmpl(type, field) ::= <<
<auxMap.(type)>
>>
top ::= <<
<makeTmpl("E", "foo")>
<makeTmpl("F", "foo")>
<makeTmpl("I", "foo")>
>>
Would previously result in...
electric foo
foo force
in foo between
Now this produces three blank lines.
Is this the correct behavior?
I'm guessing it is deprecated.
from stringtemplate4.
I'll have to look into that one. should work.
from stringtemplate4.
What happens if you use the following dictionary?
auxMap ::= [
"E": {electric <field>},
"I": {in <field> between},
"F": {<field> force},
default: {<field>}
]
from stringtemplate4.
Yes, that works.
The new syntax makes more sense, it looks more like a dictionary of anonymous templates (and not just a bunch of strings).
I guess these aren't bugs, just operator error (or maybe a soft spot in the documentation?).
As relating to documentation I noticed that in some cases the '}' needs to be escaped in v4.
e.g.
<foo: { bar | then we put in some source containing \} that needs escaping }; separator="," >
Thanks
from stringtemplate4.
top ::= <<...
should be
top() ::= <<...
As indicated by the reported error message:
t.stg 12:0: garbled template definition starting at 'top'
With that in place, the expected (and actual) text output is:
electric <field>
<field> force
in <field> between
from stringtemplate4.
Related Issues (20)
- Test failure: ClassCastException In DateRenderer HOT 2
- Hidden argument <i> reported as an error when rendering templates HOT 2
- CDATA section HOT 2
- Loading template group from STGroupDir in app running on Tomcat 8 fails HOT 12
- How to pass arguments for indirect template call? HOT 3
- Incorrect indentation HOT 4
- Integrating stringtemplate4 into OSS-Fuzz HOT 1
- ST4-testjar not found HOT 9
- Use Class.getDeclaredField instead of Class.getField HOT 2
- Separator not emitted for nulls until a value is hit HOT 4
- Multiple special characters in a single <...> does not work as documented HOT 1
- You cannot use i as variable name HOT 3
- Should support coercing the (non)emptiness of a Map or Collection to a Boolean for conditionals of the form `<if(a.p)>` where `p` is a Collection or Map HOT 2
- Comparison with python based template engines like jinja2/mustache
- Looking for code samples cited in this article: Language Translation Using ANTLR and StringTemplate HOT 4
- Support for Java records HOT 2
- Test failures like org.junit.ComparisonFailure: expected:<...etime: 7/5/05, 12:00[ ]AM> but was:<...etime: 7/5/05, 12:00[ ]AM>
- Successful test prints error
- Does it support Custom Function?
- Help newbies with ANTLR dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stringtemplate4.