You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by wo...@apache.org on 2017/10/16 01:34:13 UTC
[1/8] incubator-freemarker git commit: (Some code cleanup)
Repository: incubator-freemarker
Updated Branches:
refs/heads/2.3 22b70e941 -> 8e501b8ab
(Some code cleanup)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e726cd24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e726cd24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e726cd24
Branch: refs/heads/2.3
Commit: e726cd243aa1fccda60d26f8a791782a6f9d062c
Parents: d2a2606
Author: ddekany <dd...@apache.org>
Authored: Sat Oct 14 22:07:23 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Oct 14 22:07:23 2017 +0200
----------------------------------------------------------------------
.../freemarker/template/utility/ClassUtil.java | 23 +++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e726cd24/src/main/java/freemarker/template/utility/ClassUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/utility/ClassUtil.java b/src/main/java/freemarker/template/utility/ClassUtil.java
index 6b262f5..66944fe 100644
--- a/src/main/java/freemarker/template/utility/ClassUtil.java
+++ b/src/main/java/freemarker/template/utility/ClassUtil.java
@@ -25,7 +25,6 @@ import java.net.URL;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
-import java.util.zip.ZipException;
import freemarker.core.Environment;
import freemarker.core.Macro;
@@ -387,7 +386,10 @@ public class ClassUtil {
/**
* Very similar to {@link Class#getResourceAsStream(String)}, but throws {@link IOException} instead of returning
* {@code null} if {@code optional} is {@code false}, and attempts to work around "IllegalStateException: zip file
- * closed" and related issues (caused by bugs outside of FreeMarker).
+ * closed" and similar {@code sun.net.www.protocol.jar.JarURLConnection}-related glitches. These are caused by bugs
+ * outside of FreeMarker. Note that in cases where the JAR resource becomes broken concurrently, similar errors can
+ * still occur later when the {@link InputStream} is read ({@link #loadProperties(Class, String)} works that
+ * around as well).
*
* @return If {@code optional} is {@code false}, it's never {@code null}, otherwise {@code null} indicates that the
* resource doesn't exist.
@@ -400,6 +402,7 @@ public class ClassUtil {
throws IOException {
InputStream ins;
try {
+ // This is how we did this earlier. May uses some JarURLConnection caches, which leads to the problems.
ins = baseClass.getResourceAsStream(resource);
} catch (Exception e) {
// Workaround for "IllegalStateException: zip file closed", and other related exceptions. This happens due
@@ -421,6 +424,7 @@ public class ClassUtil {
*/
public static InputStream getReasourceAsStream(ClassLoader classLoader, String resource, boolean optional)
throws IOException {
+ // See source commends in the other overload of this method.
InputStream ins;
try {
ins = classLoader.getResourceAsStream(resource);
@@ -437,7 +441,7 @@ public class ClassUtil {
/**
* Loads a class loader resource into a {@link Properties}; tries to work around "zip file closed" and related
- * errors.
+ * {@code sun.net.www.protocol.jar.JarURLConnection} glitches.
*
* @since 2.3.27
*/
@@ -447,6 +451,7 @@ public class ClassUtil {
InputStream ins = null;
try {
try {
+ // This is how we did this earlier. May uses some JarURLConnection caches, which leads to the problems.
ins = baseClass.getResourceAsStream(resource);
} catch (Exception e) {
throw new MaybeZipFileClosedException();
@@ -456,6 +461,13 @@ public class ClassUtil {
props.load(ins);
} catch (Exception e) {
throw new MaybeZipFileClosedException();
+ } finally {
+ try {
+ ins.close();
+ } catch (Exception e) {
+ // Do nothing to suppress "ZipFile closed" and related exceptions.
+ }
+ ins = null;
}
} catch (MaybeZipFileClosedException e) {
// Workaround for "zip file closed" exception, and other related exceptions. This happens due to bugs
@@ -468,8 +480,8 @@ public class ClassUtil {
if (ins != null) {
try {
ins.close();
- } catch (ZipException e) {
- // Do nothing to suppress "ZipFile closed" exceptions.
+ } catch (Exception e) {
+ // Do nothing to suppress "ZipFile closed" and related exceptions.
}
}
}
@@ -484,6 +496,7 @@ public class ClassUtil {
}
}
+ /** Used internally to work around some JarURLConnection glitches */
private static class MaybeZipFileClosedException extends Exception {
//
}
[3/8] incubator-freemarker git commit: Manual: Documented comment
usage inside expressions
Posted by wo...@apache.org.
Manual: Documented comment usage inside expressions
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/9af0b319
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9af0b319
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9af0b319
Branch: refs/heads/2.3
Commit: 9af0b319e434be4b4e19d6cfcd118414a8b6618a
Parents: 1cb67f8
Author: ddekany <dd...@apache.org>
Authored: Sat Oct 14 22:23:55 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Oct 14 22:23:55 2017 +0200
----------------------------------------------------------------------
src/manual/en_US/book.xml | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9af0b319/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 3d74ed3..59ce86b 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -4038,6 +4038,10 @@ ${("green " + "mouse")?upper_case} <#-- GREEN MOUSE -->
<section xml:id="dgui_template_exp_comment">
<title>Comments in expressions</title>
+ <indexterm>
+ <primary>comment</primary>
+ </indexterm>
+
<para>Expression may contain comments anywhere where they can
contain ignored white-space (<link
linkend="dgui_template_exp_whitespace">see above</link>). Comments
[5/8] incubator-freemarker git commit: Test and version history entry
for edge case when one of the read methods of a bean property is inaccessible,
and the other (indexed VS non-indexed) is accessible.
Posted by wo...@apache.org.
Test and version history entry for edge case when one of the read methods of a bean property is inaccessible, and the other (indexed VS non-indexed) is accessible.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/03106619
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/03106619
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/03106619
Branch: refs/heads/2.3
Commit: 03106619036c0f427a5838b4e795f139fdf30703
Parents: f09918d
Author: ddekany <dd...@apache.org>
Authored: Sun Oct 15 21:31:10 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Oct 15 21:51:45 2017 +0200
----------------------------------------------------------------------
src/manual/en_US/book.xml | 16 +++++++
.../ext/beans/BeansWrapperMiscTest.java | 48 ++++++++++++++++++++
2 files changed, 64 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/03106619/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 421a14a..a66096e 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -27249,6 +27249,22 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
</listitem>
<listitem>
+ <para>Bug fixed (affects Java 8 and later): Regardless of the
+ value of the <literal>preferIndexedReadMethod</literal> setting
+ (see previous point), if one of the indexed read method and the
+ non-indexed read method is inaccessible (i.e., it's declared in
+ a non-public type, and wasn't inherited by a public type), while
+ the other read method is accessible, we will use the accessible
+ one. Earlier, if there was an indexed read method but it was
+ inaccessible, we have given up, and that bean property wasn't
+ visible. Such properties will now be visible again, just as
+ before Java 8. (Before Java 8
+ <literal>java.beans.Inrospector</literal> has only exposed the
+ non-indexed read method in this case, so we didn't have this
+ problem.)</para>
+ </listitem>
+
+ <listitem>
<para>Bug fixed: On OpenJDK 9 (but not on earlier versions, nor
on Oracle Java 9 (tested with <quote>build 9+181</quote>)), when
you try to use the DOM-based XML support
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/03106619/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java b/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
index 917b2b3..c3ff772 100644
--- a/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
+++ b/src/test/java/freemarker/ext/beans/BeansWrapperMiscTest.java
@@ -22,12 +22,14 @@ package freemarker.ext.beans;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
+import java.lang.reflect.Modifier;
import java.util.Collections;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+import freemarker.core._JavaVersions;
import freemarker.template.Configuration;
import freemarker.template.TemplateBooleanModel;
import freemarker.template.TemplateHashModel;
@@ -36,6 +38,7 @@ import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
import freemarker.template.TemplateSequenceModel;
+import freemarker.template.Version;
import freemarker.template.utility.Constants;
@RunWith(JUnit4.class)
@@ -95,6 +98,27 @@ public class BeansWrapperMiscTest {
assertEquals(2, ((TemplateSequenceModel) fooTM).size());
}
}
+
+ @Test
+ public void java8InaccessibleIndexedAccessibleNonIndexedReadMethodTest() throws TemplateModelException {
+ assertTrue("This test case must be ran on Java 8 or later", _JavaVersions.JAVA_8 != null);
+ assertFalse(Modifier.isPublic(BeanWithInaccessibleIndexedProperty.class.getModifiers()));
+
+ for (Version ici : new Version[] { Configuration.VERSION_2_3_26, Configuration.VERSION_2_3_27 }) {
+ BeansWrapper bw = new BeansWrapper(ici);
+ TemplateHashModel beanTM = (TemplateHashModel) bw.wrap(new BeanWithInaccessibleIndexedProperty());
+ TemplateModel fooTM = beanTM.get("foo");
+
+ assertThat(fooTM, instanceOf(TemplateSequenceModel.class));
+ assertEquals("b",
+ ((TemplateScalarModel) ((TemplateSequenceModel) fooTM).get(1)).getAsString());
+ // Even with 2.3.26, where the indexed reader was preferred, as it's inaccessible, we use the normal reader:
+ assertEquals(2, ((TemplateSequenceModel) fooTM).size());
+
+ TemplateModel barTM = beanTM.get("bar");
+ assertNull(barTM); // all read methods inaccessible
+ }
+ }
public static class BeanWithBothIndexedAndArrayProperty {
@@ -110,4 +134,28 @@ public class BeansWrapperMiscTest {
}
+ public interface HasFoo {
+ String[] getFoo();
+ }
+
+ // Note: This class is deliberately not public
+ static class BeanWithInaccessibleIndexedProperty implements HasFoo {
+
+ private final static String[] FOO = new String[] { "a", "b" };
+
+ public String getFoo(int index) {
+ return FOO[index];
+ }
+
+ // This will be accessible
+ public String[] getFoo() {
+ return FOO;
+ }
+
+ public String getBar(int index) {
+ return FOO[index];
+ }
+
+ }
+
}
[6/8] incubator-freemarker git commit: Documented OpenJDK 9 Xalan
dependency in the README.
Posted by wo...@apache.org.
Documented OpenJDK 9 Xalan dependency in the README.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/5a8752d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/5a8752d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/5a8752d3
Branch: refs/heads/2.3
Commit: 5a8752d3471b59514a2403cdcee284d50c5f2022
Parents: 0310661
Author: ddekany <dd...@apache.org>
Authored: Sun Oct 15 22:29:29 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Oct 15 22:29:29 2017 +0200
----------------------------------------------------------------------
README.md | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5a8752d3/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f191947..0337f86 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,12 @@ dependencies, but usually you don't have to deal with them, because if
you are using an optional feature that's certainly because your
application already uses the related library.
+Attention: If you upgrade to OpenJDK 9 or later, and you are using
+XPath queries in templates, you will need to add Apache Xalan as a
+dependency, as freemarker.ext.dom can't use the XPath support
+included in OpenJDK anymore. It's not needed on Oracle Java 9,
+or if FreeMarker is configured to use Jaxen for XPath.
+
The minimum required Java version is currently Java SE 5. (The presence
of a later version may be detected on runtime and utilized by
FreeMarker.)
[8/8] incubator-freemarker git commit: In 2.3.27 release process:
Merge branch '2.3-gae' into 2.3
Posted by wo...@apache.org.
In 2.3.27 release process: Merge branch '2.3-gae' into 2.3
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/8e501b8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/8e501b8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/8e501b8a
Branch: refs/heads/2.3
Commit: 8e501b8ab83fb7d312791a4907ca94ef8acaf3e5
Parents: c49baea 5a8752d
Author: Woonsan Ko <wo...@apache.org>
Authored: Sun Oct 15 21:17:50 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Sun Oct 15 21:17:50 2017 -0400
----------------------------------------------------------------------
README.md | 6 ++
.../freemarker/template/utility/ClassUtil.java | 23 +++++--
src/manual/en_US/book.xml | 70 ++++++++++++++++----
.../ext/beans/BeansWrapperMiscTest.java | 48 ++++++++++++++
4 files changed, 128 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8e501b8a/src/manual/en_US/book.xml
----------------------------------------------------------------------
[7/8] incubator-freemarker git commit: Updaring the versions and
history to start 2.3.27 release process
Posted by wo...@apache.org.
Updaring the versions and history to start 2.3.27 release process
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c49baeaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c49baeaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c49baeaf
Branch: refs/heads/2.3
Commit: c49baeafd754b9c8566122c5a69ec41a705b722a
Parents: 22b70e9
Author: Woonsan Ko <wo...@apache.org>
Authored: Sun Oct 15 21:17:07 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Sun Oct 15 21:17:07 2017 -0400
----------------------------------------------------------------------
src/main/resources/freemarker/version.properties | 8 ++++----
src/manual/en_US/book.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c49baeaf/src/main/resources/freemarker/version.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/freemarker/version.properties b/src/main/resources/freemarker/version.properties
index d104dc0..c9ddd18 100644
--- a/src/main/resources/freemarker/version.properties
+++ b/src/main/resources/freemarker/version.properties
@@ -58,11 +58,11 @@
# - When the major version number is increased, major backward
# compatibility violations are allowed, but still should be avoided.
# During Apache Incubation, "-incubating" is added to this string.
-version=2.3.27-nightly_@timestampInVersion@-incubating
+version=2.3.27-incubating
# This exists as for Maven we use "-SNAPSHOT" for nightly releases,
# and no _nightly_@timestampInVersion@. Also, "-incubating" is added
# *before* "-SNAPSHOT". For final releases it's the same as "version".
-mavenVersion=2.3.27-incubating-SNAPSHOT
+mavenVersion=2.3.27-incubating
# Version string that conforms to OSGi
# ------------------------------------
@@ -76,7 +76,7 @@ mavenVersion=2.3.27-incubating-SNAPSHOT
# 2.4.0.pre01
# 2.4.0.nightly_@timestampInVersion@
# During Apache Incubation, "-incubating" is added to this string.
-versionForOSGi=2.3.27.nightly_@timestampInVersion@-incubating
+versionForOSGi=2.3.27.stable-incubating
# Version string that conforms to legacy MF
# -----------------------------------------
@@ -95,7 +95,7 @@ versionForOSGi=2.3.27.nightly_@timestampInVersion@-incubating
# "97 denotes "nightly", 98 denotes "pre", 99 denotes "rc" build.
# In general, for the nightly/preview/rc Y of version 2.X, the versionForMf is
# 2.X-1.(99|98).Y. Note the X-1.
-versionForMf=2.3.26.97
+versionForMf=2.3.27
# The date of the build.
# This should be automatically filled by the building tool (Ant).
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c49baeaf/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 2e77c0a..5aba725 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -27048,7 +27048,7 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
<section xml:id="versions_2_3_27">
<title>2.3.27 (incubating at Apache)</title>
- <para>Release date: 2017-10-03 + release process</para>
+ <para>Release date: 2017-10-15 + release process</para>
<para><emphasis role="bold">This is a stable, final
release.</emphasis> The <quote>incubating</quote> suffix is required
[4/8] incubator-freemarker git commit: Manual: Version history typos
Posted by wo...@apache.org.
Manual: Version history typos
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f09918d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f09918d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f09918d2
Branch: refs/heads/2.3
Commit: f09918d28ebf20b2993920610e525ff5d848f565
Parents: 9af0b31
Author: ddekany <dd...@apache.org>
Authored: Sun Oct 15 21:29:37 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Oct 15 21:29:37 2017 +0200
----------------------------------------------------------------------
src/manual/en_US/book.xml | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f09918d2/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 59ce86b..421a14a 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -27216,19 +27216,20 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
</listitem>
<listitem>
- <para>Bug fixed: <literal>BeansWrapper</literal> and
- <literal>DefaultObjectWrapper</literal>, starting from Java 8,
- when the same JavaBeans property has both non-indexed read
- method (like <literal>String[] getFoos()</literal>) and indexed
- read method (like <literal>String getFoos(int index)</literal>),
- has mistakenly used the indexed read method to access the
- property. This is a problem because then the array size was
- unknown, and thus the property has suddenly become unlistable on
- Java 8 (that is, <literal><#list myObject.foos as
- foo></literal> fails). To enable the fix (where it will use
- the non-indexed read method), you should to increase the value
- of the <literal>incompatibleImprovements</literal> constructor
- argument of the used <literal>DefaultObjectWrapper</literal> or
+ <para>Bug fixed: Starting from Java 8, when the same JavaBeans
+ property has both non-indexed read method (like
+ <literal>String[] getFoos()</literal>) and indexed read method
+ (like <literal>String getFoos(int index)</literal>),
+ <literal>BeansWrapper</literal> and
+ <literal>DefaultObjectWrapper</literal> have mistakenly used the
+ indexed read method to access the property. This is a problem
+ because then the array size was unknown, and thus the property
+ has suddenly become unlistable on Java 8 (that is,
+ <literal><#list myObject.foos as foo></literal> fails). To
+ enable the fix (where it will use the non-indexed read method),
+ you should increase the value of the
+ <literal>incompatibleImprovements</literal> constructor argument
+ of the used <literal>DefaultObjectWrapper</literal> or
<literal>BeansWrapper</literal> to 2.3.27. Note that if you
leave the <literal>object_wrapper</literal> setting of the
<literal>Configuration</literal> on its default, it's enough to
@@ -27257,7 +27258,7 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
<literal>IllegalAccessError</literal> because <quote>java.xml
does not export com.sun.org.apache.xml.internal.utils</quote>.
Note that while the exception is not thrown anymore in 2.3.27,
- FreeMarker can't use the XPath support included in Open JDK 9,
+ FreeMarker can't use the XPath support included in OpenJDK 9,
and so templates that try to use XPath expressions (like
<literal>doc['//foo']</literal>) will still fail, <link
linkend="xgui_imperative_learn_xpath">unless 3rd party XPath
[2/8] incubator-freemarker git commit: Manual: Documented comment
usage inside expressions
Posted by wo...@apache.org.
Manual: Documented comment usage inside expressions
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/1cb67f87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/1cb67f87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/1cb67f87
Branch: refs/heads/2.3
Commit: 1cb67f87c3f1fc4337d8a2b8cf4499c1ac177d2e
Parents: e726cd2
Author: ddekany <dd...@apache.org>
Authored: Sat Oct 14 22:21:28 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Oct 14 22:21:28 2017 +0200
----------------------------------------------------------------------
src/manual/en_US/book.xml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1cb67f87/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 1e0e4d9..3d74ed3 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -4035,6 +4035,27 @@ ${("green " + "mouse")?upper_case} <#-- GREEN MOUSE -->
}</programlisting>
</section>
+ <section xml:id="dgui_template_exp_comment">
+ <title>Comments in expressions</title>
+
+ <para>Expression may contain comments anywhere where they can
+ contain ignored white-space (<link
+ linkend="dgui_template_exp_whitespace">see above</link>). Comments
+ look like <literal><#-- ... --></literal> or as <literal>[#--
+ ... --]</literal>. Example:</para>
+
+ <programlisting role="template"><#assign x <#-- A comment --> = 123 <#-- A comment -->>
+<#function f(x <#-- A comment -->, y <#-- A comment -->)>
+ <#return <#-- A comment --> 1 <#-- A comment -->>
+</#function>
+<#assign someHash = {
+ "foo": 123, <#-- A comment -->
+ "bar": x <#-- A comment --> + 1,
+ <#-- A comment -->
+ "baaz": f(1 <#-- A comment -->, 2 <#-- A comment -->)
+} <#-- A comment -->></programlisting>
+ </section>
+
<section xml:id="dgui_template_exp_precedence">
<title>Operator precedence</title>