Comments (3)
Find STRecursionBug.zip in attachments.
from stringtemplate4.
You are invoking templates with unbound anonymous templates as arguments, with the syntax {...}
.
std_field_dropdown(dropdown_field,depends_from) ::= <<
<std_field(dropdown_field,{<std_field_id(dropdown_field.name,[])>},depends_from)>
>>
std_field_selection(selection_field,sel_bt,depends_from) ::= <<
<std_field(selection_field,{<std_field_id(selection_field.name,sel_bt.value)>},depends_from)>
>>
std_field_text(text_field,depend_on) ::= <<
<std_field(text_field,{<std_field_id(text_field.name,[])>},depend_on)>
>>
std_field_textarea(txtarea_field,depends) ::= <<
<std_field(txtarea_field,{<std_field_id(txtarea_field.name,[])>},depends)>
>>
These templates are bound at the time they are rendered, which is a different context from where they are created. What you want to do is force these anonymous templates to bind and render in the current context and pass the evaluated result as the argument, with the syntax ({...})
.
std_field_dropdown(dropdown_field,depends_from) ::= <<
<std_field(dropdown_field,({<std_field_id(dropdown_field.name,[])>}),depends_from)>
>>
std_field_selection(selection_field,sel_bt,depends_from) ::= <<
<std_field(selection_field,({<std_field_id(selection_field.name,sel_bt.value)>}),depends_from)>
>>
std_field_text(text_field,depend_on) ::= <<
<std_field(text_field,({<std_field_id(text_field.name,[])>}),depend_on)>
>>
std_field_textarea(txtarea_field,depends) ::= <<
<std_field(txtarea_field,({<std_field_id(txtarea_field.name,[])>}),depends)>
>>
from stringtemplate4.
just to be clear
std_field_dropdown(dropdown_field,depends_from) ::= <<
<std_field(dropdown_field,{<std_field_id(dropdown_field.name,[])>},depends_from)>
>>
passes an anonymous template, referencing argument dropdown_field
, to another template whose context does not have dropdown_field
. ST does dynamic lookup of attributes and does not bind them like closures would in a programming language.
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.