New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STGroupString does not honor delimeter stanza in a string definition #46
Comments
I am not able to reproduce this problem. I used the following unit test which passed: @Test public void testDelimitersClauseInGroupString() throws Exception {
String templates =
"delimiters \"$\", \"$\""+newline+
"method(name) ::= <<"+newline+
"$stat(name)$" +newline+
">>"+newline+
"stat(name,value=\"99\") ::= \"x=$value$; // $name$\""+newline
;
STGroup group = new STGroupString(templates);
ST b = group.getInstanceOf("method");
b.add("name", "foo");
String expecting = "x=99; // foo";
String result = b.render();
assertEquals(expecting, result);
} |
You aren't doing what I am doing, I am reading the String from a "File". It doesn't work when you read the String from some resource. I can't use a regular file because Google App Engine doesn't support real "File" objects. So I have to read from a Blob into a String and then try and create the STGroupString, if fails miserably when doing it this way.
test-html.stg 1:0: garbled template definition starting at 'delimiters' Process finished with exit code 1 |
You misspelled |
It doesn't work with delimiters spelled correctly, t |
What is the error in that case? |
same error, I attached a screen shot of what my source template looks like in SubEthaEdit
Here is the code I am using to read in the file to a String:
|
Are you sure you're using a version of ST4 that supports the You can try running my unit test code in |
I am using 4.0.2, which version supports
|
Upgrading my pom.xml to
fixed the delimiters issue, but I am still getting the following error, when the very first thing in my template is
Exception in thread "main" java.lang.IllegalArgumentException: no such attribute: template_name |
Your
|
When the following text is loaded into a String and used to create a STGroupString, the "delimiters" line is not honored and you get the default "<", ">" delimiters instead.
I am loading my templates from the Google App Engine Blob store and the easiest way to get them into ST is with STGroupString.
The text was updated successfully, but these errors were encountered: