[GitHub] incubator-freemarker pull request #31: FREEMARKER-55: spring.ftl marco lib s...
GitHub user woonsan opened a pull request: https://github.com/apache/incubator-freemarker/pull/31 FREEMARKER-55: spring.ftl marco lib support - Support <#import "/spring.ftl" as spring> like Spring Framework does. - By default, the system lib from /spring.ftl is read from the specific classpath, not from app's template path. The system template aliases map can be customized through SpringResourceTemplateLoader.systemTemplateAliases property. - The same macros and functions are defined in /spring.ftl as Spring Framework's, with syntax changes to comply with FM3. - Note: As the system template lib support is handled by SpringTemplateLoader in this PR, it means developers should always use SpringTemplateLoader directly or indirectly in order to use the system macro library. Please review this decision. - TODOs: review/test/refine each macro and functions in spring.ftl. You can merge this pull request into a Git repository by running: $ git pull https://github.com/woonsan/incubator-freemarker feature/FREEMARKER-55 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-freemarker/pull/31.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #31 commit 8e0f33c419d982279d7fb22a9dfdc66f47abaf2c Author: Woonsan Ko Date: 2017-07-14T15:27:17Z FREEMARKER-55: Renaming Freemarker to FreeMarker commit ec8d687d4ce2c0e1bb3e3ca073b139eacc198527 Author: Woonsan Ko Date: 2017-07-14T15:53:51Z Merge branch '3' into feature/FREEMARKER-55 commit e7cb6f7cfc241689c85527971bf6e1ea7ced9127 Author: Woonsan Ko Date: 2017-07-14T17:57:29Z Merge branch '3' into feature/FREEMARKER-55 commit c6eb09de91e57035c1e0e3c4d3490b3b96622bab Author: Woonsan Ko Date: 2017-07-16T18:24:55Z Merge branch '3' into feature/FREEMARKER-55 commit 870209fa8e0acd0bb3186053dfd549b5c758e37d Author: Woonsan Ko Date: 2017-07-18T00:38:03Z Merge branch '3' into feature/FREEMARKER-55 commit 4481406a2f4eeb30d6d044a4ac158efab7ba7a7b Author: Woonsan Ko Date: 2017-08-06T01:28:54Z Merge branch '3' into feature/FREEMARKER-55 commit fcd9e672ec515e3042bc5efd229b7d12c23e7d88 Author: Woonsan Ko Date: 2017-08-06T05:09:12Z FREEMARKER-55: system template lib for spring app: spring.ftl. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (FREEMARKER-55) FM3 freemarker-spring module, Web MVC support
[ https://issues.apache.org/jira/browse/FREEMARKER-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16115649#comment-16115649 ] ASF GitHub Bot commented on FREEMARKER-55: -- GitHub user woonsan opened a pull request: https://github.com/apache/incubator-freemarker/pull/31 FREEMARKER-55: spring.ftl marco lib support - Support <#import "/spring.ftl" as spring> like Spring Framework does. - By default, the system lib from /spring.ftl is read from the specific classpath, not from app's template path. The system template aliases map can be customized through SpringResourceTemplateLoader.systemTemplateAliases property. - The same macros and functions are defined in /spring.ftl as Spring Framework's, with syntax changes to comply with FM3. - Note: As the system template lib support is handled by SpringTemplateLoader in this PR, it means developers should always use SpringTemplateLoader directly or indirectly in order to use the system macro library. Please review this decision. - TODOs: review/test/refine each macro and functions in spring.ftl. You can merge this pull request into a Git repository by running: $ git pull https://github.com/woonsan/incubator-freemarker feature/FREEMARKER-55 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-freemarker/pull/31.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #31 commit 8e0f33c419d982279d7fb22a9dfdc66f47abaf2c Author: Woonsan Ko Date: 2017-07-14T15:27:17Z FREEMARKER-55: Renaming Freemarker to FreeMarker commit ec8d687d4ce2c0e1bb3e3ca073b139eacc198527 Author: Woonsan Ko Date: 2017-07-14T15:53:51Z Merge branch '3' into feature/FREEMARKER-55 commit e7cb6f7cfc241689c85527971bf6e1ea7ced9127 Author: Woonsan Ko Date: 2017-07-14T17:57:29Z Merge branch '3' into feature/FREEMARKER-55 commit c6eb09de91e57035c1e0e3c4d3490b3b96622bab Author: Woonsan Ko Date: 2017-07-16T18:24:55Z Merge branch '3' into feature/FREEMARKER-55 commit 870209fa8e0acd0bb3186053dfd549b5c758e37d Author: Woonsan Ko Date: 2017-07-18T00:38:03Z Merge branch '3' into feature/FREEMARKER-55 commit 4481406a2f4eeb30d6d044a4ac158efab7ba7a7b Author: Woonsan Ko Date: 2017-08-06T01:28:54Z Merge branch '3' into feature/FREEMARKER-55 commit fcd9e672ec515e3042bc5efd229b7d12c23e7d88 Author: Woonsan Ko Date: 2017-08-06T05:09:12Z FREEMARKER-55: system template lib for spring app: spring.ftl. > FM3 freemarker-spring module, Web MVC support > - > > Key: FREEMARKER-55 > URL: https://issues.apache.org/jira/browse/FREEMARKER-55 > Project: Apache Freemarker > Issue Type: Task >Affects Versions: 3.0.0 >Reporter: Daniel Dekany > > Add Spring "Web MVC framework" functionality to freemarker-spring. > This can be complex task (and the issue possibly has to be subdivided), as it > involves things like: > * Some aspects of the FreeMarker 2 integration (developed by the Spring > developers) are quite confusing ({{FreemarerConfigurer}}, etc.), and we are > looking into if it needs to be like that. > * See if we can support {{@EnableWebMvc}} (note that FreeMarker 2 support is > hard coded into {{ViewResolverRegistry}}, which we can't modify) > * Creating custom directives/methods to expose Spring features like the > Spring JSP Tag Library does (but in a way that firs FreeMarker better) > * Expose JSP custom tag support from the {{freemarker-servlet}} module. > Depends on: FREEMARKER-54 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[30/50] incubator-freemarker git commit: Updated version number
Updated version number Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a36ea523 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a36ea523 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a36ea523 Branch: refs/heads/2.3 Commit: a36ea52359bd90fa45340537b66ec58216f8be41 Parents: 9b3d130 Author: ddekany Authored: Sat Jul 8 00:51:20 2017 +0200 Committer: ddekany Committed: Sat Jul 8 00:52:15 2017 +0200 -- src/main/resources/freemarker/version.properties | 11 +-- .../freemarker/template/DefaultObjectWrapperTest.java| 1 + 2 files changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a36ea523/src/main/resources/freemarker/version.properties -- diff --git a/src/main/resources/freemarker/version.properties b/src/main/resources/freemarker/version.properties index 4750d18..9a1a8c5 100644 --- a/src/main/resources/freemarker/version.properties +++ b/src/main/resources/freemarker/version.properties @@ -58,12 +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.26-incubating -# This exists as oss.sonatype only allows SNAPSHOT and final releases, -# so instead 2.3.21-rc01 and such we have to use 2.3.21-SNAPSHOT there. -# For final releases it's the same as "version". -# During Apache Incubation, "-incubating" is added to this string. -mavenVersion=2.3.26-incubating +version=2.3.27-nightly_@timestampInVersion@-incubating +# This exists as for Maven we use "-SNAPSHOT" for non-final releases. +# For final releases it's the same as "version". During Apache +# Incubation, "-incubating" is added *before* "-SNAPSHOT". +mavenVersion=2.3.27-incubating-SNAPSHOT # Version string that conforms to OSGi # http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a36ea523/src/test/java/freemarker/template/DefaultObjectWrapperTest.java -- diff --git a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java index dcbc659..9a9e283 100644 --- a/src/test/java/freemarker/template/DefaultObjectWrapperTest.java +++ b/src/test/java/freemarker/template/DefaultObjectWrapperTest.java @@ -93,6 +93,7 @@ public class DefaultObjectWrapperTest { expected.add(Configuration.VERSION_2_3_24); expected.add(Configuration.VERSION_2_3_24); // no non-BC change in 2.3.25 expected.add(Configuration.VERSION_2_3_26); +expected.add(Configuration.VERSION_2_3_26); // no non-BC change in 2.3.27 List actual = new ArrayList(); for (int i = _TemplateAPI.VERSION_INT_2_3_0; i <= Configuration.getVersion().intValue(); i++) {
[45/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/b9978edd Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/b9978edd Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/b9978edd Branch: refs/heads/2.3 Commit: b9978edde7822046f81c0976a10028940d9bd990 Parents: 7d01bed Author: ddekany Authored: Sat Aug 5 12:22:49 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:22:49 2017 +0200 -- .travis.yml | 3 +-- build.xml | 11 ++- 2 files changed, 11 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c68923b..c0493be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ -dist: trusty language: java -install: ant download-ivy +install: ant download-ivy download-junit script: ant ci jdk: - oraclejdk8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/build.xml -- diff --git a/build.xml b/build.xml index 32e4168..1e7e340 100644 --- a/build.xml +++ b/build.xml @@ -135,12 +135,21 @@ - https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"; dest="${ivy.jar.file}" usetimestamp="true"/> + + + + + + + +https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"; + dest="${ant-junit.jar.file}" usetimestamp="true"/> +
[26/50] incubator-freemarker git commit: (JavaDoc improvement)
(JavaDoc improvement) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c30c6996 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c30c6996 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c30c6996 Branch: refs/heads/2.3 Commit: c30c699635b830f7bd5c4a5523242641d454830a Parents: 387dcd4 Author: ddekany Authored: Sun Jul 2 19:11:20 2017 +0200 Committer: ddekany Committed: Sun Jul 2 19:11:20 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c30c6996/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 9084956..4887dfe 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -1324,12 +1324,8 @@ public class Configurable { * output, or if you want to suppress certain exceptions. If you suppress an exception, and the * {@link Environment#getLogTemplateExceptions()} returns {@code false}, then it's the responsibility of the * {@link TemplateExceptionHandler} to log the exception (if you want it to be logged). - * - * The {@link #setLogTemplateExceptions(boolean) log_template_exceptions} and - * {@link #setAttemptExceptionReporter(AttemptExceptionReporter) attempt_exception_reporter} settings take effect - * before the {@link TemplateExceptionHandler} is invoked, so these settings are technically independent, and deal - * with different aspects of exception handling. * + * @see #setLogTemplateExceptions(boolean) * @see #setAttemptExceptionReporter(AttemptExceptionReporter) */ public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler) { @@ -1366,6 +1362,8 @@ public class Configurable { * * The {@link AttemptExceptionReporter} is invoked regardless of the value of the * {@link #setLogTemplateExceptions(boolean) log_template_exceptions} setting. + * The {@link AttemptExceptionReporter} is not invoked if the {@link TemplateExceptionHandler} has suppressed the + * exception. * * @since 2.3.27 */
[32/50] incubator-freemarker git commit: Bug fixed: Comments were not allowed by the parser between the switch tag and the first case tag.
Bug fixed: Comments were not allowed by the parser between the switch tag and the first case tag. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/1dba510c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/1dba510c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/1dba510c Branch: refs/heads/2.3 Commit: 1dba510cc690898523e138385dd8eb4111b32453 Parents: 9b87988 Author: ddekany Authored: Sat Jul 8 19:33:39 2017 +0200 Committer: ddekany Committed: Sat Jul 8 19:33:39 2017 +0200 -- src/main/java/freemarker/core/Case.java| 4 +- src/main/java/freemarker/core/SwitchBlock.java | 31 -- src/main/javacc/FTL.jj | 66 +++-- src/manual/en_US/book.xml | 6 ++ 4 files changed, 95 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/java/freemarker/core/Case.java -- diff --git a/src/main/java/freemarker/core/Case.java b/src/main/java/freemarker/core/Case.java index c580c4d..6d23716 100644 --- a/src/main/java/freemarker/core/Case.java +++ b/src/main/java/freemarker/core/Case.java @@ -24,8 +24,8 @@ package freemarker.core; */ final class Case extends TemplateElement { -final int TYPE_CASE = 0; -final int TYPE_DEFAULT = 1; +static final int TYPE_CASE = 0; +static final int TYPE_DEFAULT = 1; Expression condition; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/java/freemarker/core/SwitchBlock.java -- diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java index cfa354c..15a5eea 100644 --- a/src/main/java/freemarker/core/SwitchBlock.java +++ b/src/main/java/freemarker/core/SwitchBlock.java @@ -30,13 +30,20 @@ final class SwitchBlock extends TemplateElement { private Case defaultCase; private final Expression searched; +private int firstCaseIndex; /** * @param searched the expression to be tested. */ -SwitchBlock(Expression searched) { +SwitchBlock(Expression searched, MixedContent ignoredSectionBeforeFirstCase) { this.searched = searched; -setChildBufferCapacity(4); + +int ignoredCnt = ignoredSectionBeforeFirstCase != null ? ignoredSectionBeforeFirstCase.getChildCount() : 0; +setChildBufferCapacity(ignoredCnt + 4); +for (int i = 0; i < ignoredCnt; i++) { +addChild(ignoredSectionBeforeFirstCase.getChild(i)); +} +firstCaseIndex = ignoredCnt; // Note that normally postParseCleanup will overwrite this } /** @@ -55,7 +62,7 @@ final class SwitchBlock extends TemplateElement { boolean processedCase = false; int ln = getChildCount(); try { -for (int i = 0; i < ln; i++) { +for (int i = firstCaseIndex; i < ln; i++) { Case cas = (Case) getChild(i); boolean processCase = false; @@ -94,8 +101,7 @@ final class SwitchBlock extends TemplateElement { buf.append('>'); int ln = getChildCount(); for (int i = 0; i < ln; i++) { -Case cas = (Case) getChild(i); -buf.append(cas.getCanonicalForm()); +buf.append(getChild(i).getCanonicalForm()); } buf.append("'); } @@ -128,5 +134,20 @@ final class SwitchBlock extends TemplateElement { boolean isNestedBlockRepeater() { return false; } + +@Override +TemplateElement postParseCleanup(boolean stripWhitespace) throws ParseException { +TemplateElement result = super.postParseCleanup(stripWhitespace); + +// The first #case might have shifted in the child array, so we have to find it again: +int ln = getChildCount(); +int i = 0; +while (i < ln && !(getChildAt(i) instanceof Case)) { +i++; +} +firstCaseIndex = i; + +return result; +} } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1dba510c/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index 94338af..fb6106d 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3581,18 +3581,22 @@ TransformBlock Transform() : SwitchBlock Switch() : { SwitchBlock switchBlock; +MixedContent ignoredSectionBeforeFirstCase = null; Case caseIns; Expression switchExp; Token s
[20/50] incubator-freemarker git commit: (Error message typo. Better error message for allow_nothing VS allows_nothing.)
(Error message typo. Better error message for allow_nothing VS allows_nothing.) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/dc3277e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/dc3277e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/dc3277e0 Branch: refs/heads/2.3 Commit: dc3277e0d52ad304abdffe6f687d0a152071d5dc Parents: 3fc5f90 Author: ddekany Authored: Tue Jun 13 18:57:07 2017 +0200 Committer: ddekany Committed: Tue Jun 13 18:57:07 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/dc3277e0/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 7262e4f..914015a 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -947,7 +947,7 @@ public class Configurable { int commaIdx = booleanFormat.indexOf(','); if (commaIdx == -1) { throw new IllegalArgumentException( -"Setting value must be string that contains two comma-separated values for true and false, " + +"Setting value must be a string that contains two comma-separated values for true and false, " + "respectively."); } @@ -2538,6 +2538,12 @@ public class Configurable { } setNewBuiltinClassResolver( new OptInTemplateClassResolver(allowedClasses, trustedTemplates)); +} else if ("allow_nothing".equals(value)) { +throw new IllegalArgumentException( +"The correct value would be: allows_nothing"); +} else if ("allowNothing".equals(value)) { +throw new IllegalArgumentException( +"The correct value would be: allowsNothing"); } else if (value.indexOf('.') != -1) { setNewBuiltinClassResolver((TemplateClassResolver) _ObjectBuilderSettingEvaluator.eval( value, TemplateClassResolver.class, false,
[18/50] incubator-freemarker git commit: Configuration object builder expression: Slightly improved error message for something=NoSuchClass when the class name contains no dot
Configuration object builder expression: Slightly improved error message for something=NoSuchClass when the class name contains no dot Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f0a6f451 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f0a6f451 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f0a6f451 Branch: refs/heads/2.3 Commit: f0a6f4511e79d2e7aeb3d6ba5c7c2b12b96159b8 Parents: 017e9f5 Author: ddekany Authored: Fri May 26 10:22:25 2017 +0200 Committer: ddekany Committed: Fri May 26 10:22:25 2017 +0200 -- src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f0a6f451/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java -- diff --git a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java index 2f91b55..ae99899 100644 --- a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java +++ b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java @@ -879,7 +879,7 @@ public class _ObjectBuilderSettingEvaluator { throw new LegacyExceptionWrapperSettingEvaluationExpression(e); } } catch (LegacyExceptionWrapperSettingEvaluationExpression e) { -if (!canBeStaticField) { +if (!canBeStaticField || className.indexOf('.') == -1) { throw e; } // Silently try to interpret className as static filed, throw the original exception if that fails.
[13/50] incubator-freemarker git commit: (README heading hierarchy fix)
(README heading hierarchy fix) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e64dc4dd Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e64dc4dd Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e64dc4dd Branch: refs/heads/2.3 Commit: e64dc4dd8a95476b82917273fe7b06fbc07c95ab Parents: 0c22546 Author: ddekany Authored: Mon Apr 17 23:01:11 2017 +0200 Committer: ddekany Committed: Mon Apr 17 23:01:11 2017 +0200 -- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e64dc4dd/README.md -- diff --git a/README.md b/README.md index d175433..6441fd6 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ link. Building FreeMarker -=== +--- If you haven't yet, download the source release, or checkout FreeMarker from the source code repository. See repository locations here: @@ -123,7 +123,7 @@ To generate documentation, issue `ant javadoc` and `ant manualOffline`. Eclipse and other IDE setup -=== +--- Below you find the step-by-step setup for Eclipse Mars.1. If you are using a different version or an entierly different IDE, still read this, and try to
[27/50] incubator-freemarker git commit: Manual: Improved #attempt/#recover documentation
Manual: Improved #attempt/#recover documentation Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/5d81db7d Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/5d81db7d Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/5d81db7d Branch: refs/heads/2.3 Commit: 5d81db7dad0f1a54964b3fc8ec348d41988a9e4d Parents: c30c699 Author: ddekany Authored: Sun Jul 2 19:11:49 2017 +0200 Committer: ddekany Committed: Sun Jul 2 19:11:49 2017 +0200 -- src/manual/en_US/book.xml | 46 +- 1 file changed, 27 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5d81db7d/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 05435b0..fbbee7e 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -2971,7 +2971,7 @@ J substring -You can a slice a string in the same way as you You can slice a string in the same way as you slice a sequence (see there), only here instead of sequence items you work with characters. Some differences are: @@ -2989,7 +2989,8 @@ J multi-typed value), then slicing will slice the sequence instead of the string. When you are processing XML, such values are common. In such cases you can use - someXMLnode?string[range]. + someXMLnode?string[range] +to fore string slicing. @@ -18876,13 +18877,16 @@ ${x} outputted even if the outputting of a certain part of the page fails. If an error occurs during the execution of the attempt block, then - the template execution is not aborted, but the - recover block is - executed instead of the attempt - block. If no error occurs during the - execution of the attempt - block, then the + the output of the attempt + block is rolled back (and the error is logged, with the default + configuration at least), and the recover block is + executed instead, then template execution continues normally after + the recover block. If + no error occurs during the execution of the + attempt block, then + the recover block is ignored. A simple example: Primary content @@ -18893,8 +18897,9 @@ ${x} #attempt> Primary content continued - If the thisMayFails variable doesn't exist, - then the output is: + If the thisMayFails variable doesn't exist + (or any other error occurs at that place), then the output + is: Primary content Ops! The optional content is not available. @@ -18953,15 +18958,18 @@ Primary content continued By default errors occurring inside an attempt - block are logged as errors. This is because - attempt is not supposed to be a general purpose - error handler mechanism, like try is in Java. - It's for decreasing the impact of unexpected errors, by making it - possible that only part of the page is going down, instead of the - whole page. But it's still an error, something that someone should - fix. (The way this error is reported can be customized with the - attempt_exception_reporter configuration - setting.) + block are logged with + ERROR level, despite that the template recovers + from them. This is because attempt is not meant + to be a general purpose error handler mechanism, like + try is in Java. It's for decreasing the impact of + unexpected errors on the visitors, by making it possible that only + part of the page is going down, instead of the whole page. But it's + still an error, something that needs the attention of the operators. + (The way this error is reported can be customized with the + attempt_exception_reporter configuration setting, + since FreeMarker 2.3.27.)
[41/50] incubator-freemarker git commit: Documented the precision of arithmetical operations
Documented the precision of arithmetical operations Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/2aebfe53 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/2aebfe53 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/2aebfe53 Branch: refs/heads/2.3 Commit: 2aebfe53331a6306481d44cee94eb45c6f42797b Parents: e3d1bb8 Author: ddekany Authored: Sat Aug 5 11:05:32 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:05:32 2017 +0200 -- .../java/freemarker/core/ArithmeticEngine.java| 5 +++-- src/manual/en_US/book.xml | 18 -- 2 files changed, 19 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/main/java/freemarker/core/ArithmeticEngine.java -- diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java index c07dc92..5e485b8 100644 --- a/src/main/java/freemarker/core/ArithmeticEngine.java +++ b/src/main/java/freemarker/core/ArithmeticEngine.java @@ -30,9 +30,10 @@ import freemarker.template.utility.OptimizerUtil; import freemarker.template.utility.StringUtil; /** - * Class to perform arithmetic operations. + * Used for implementing the arithmetic operations and number comparisons in the template language. The concrete + * implementation is plugged into the configuration with the {@code arithmetical_engine} setting. + * (See {@link Configurable#setArithmeticEngine(ArithmeticEngine)}.) */ - public abstract class ArithmeticEngine { /** http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index e072d1a..1288f8a 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -3304,8 +3304,6 @@ Slicing with right-unlimited ranges: - Information about the precision? - Example: ${100 - x * x} @@ -3385,6 +3383,22 @@ ${12 % 6.9} <#-- Prints 0 --> ${-12 % 5} <#-- Prints -2 --> ${12 % -5} <#-- Prints 2 --> + + About the precision of the operations: + By default FreeMarker uses BigDecimal-s for all + arithmetical calculations, to avoid rounding and overflow/underflow + artifacts, and also keeps the result as + BigDecimal-s. So + (addition), + - (subtraction) and * + (multiplication) are lossless. Again by default, + / (division) results are calculated to 12 + decimals with half-up rounding (unless some operands have even more + decimals, in which case it's calculated with that much decimals). + All this behavior depends on the + arithmetic_engine configuration setting + (Configurable.setArithmericEngine(ArithmericEngine)) + though, and some application might use a different value than the + default, although that's highly uncommon.
[16/50] incubator-freemarker git commit: (JavaDoc typos)
(JavaDoc 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/7b35587e Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7b35587e Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7b35587e Branch: refs/heads/2.3 Commit: 7b35587ebf34f94b9d378c70da6ab8cae130e246 Parents: a566847 Author: ddekany Authored: Fri May 26 10:05:38 2017 +0200 Committer: ddekany Committed: Fri May 26 10:05:38 2017 +0200 -- src/main/java/freemarker/cache/TemplateNameFormat.java | 4 ++-- src/main/java/freemarker/core/_Java8Impl.java | 2 +- src/main/java/freemarker/template/TemplateNodeModelEx.java | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/cache/TemplateNameFormat.java -- diff --git a/src/main/java/freemarker/cache/TemplateNameFormat.java b/src/main/java/freemarker/cache/TemplateNameFormat.java index 99763d0..72126bf 100644 --- a/src/main/java/freemarker/cache/TemplateNameFormat.java +++ b/src/main/java/freemarker/cache/TemplateNameFormat.java @@ -26,8 +26,8 @@ import freemarker.template.Version; import freemarker.template.utility.StringUtil; /** - * Symbolized template name format. The API of this class isn't exposed as it's too immature, so custom - * template name formats aren't possible yet. + * Symbolizes a template name format, which defines the basic syntax of names through algorithms such as normalization. + * The API of this class isn't exposed as it's too immature, so custom template name formats aren't possible yet. * * @since 2.3.22 */ http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/core/_Java8Impl.java -- diff --git a/src/main/java/freemarker/core/_Java8Impl.java b/src/main/java/freemarker/core/_Java8Impl.java index 40f0910..fa8b528 100644 --- a/src/main/java/freemarker/core/_Java8Impl.java +++ b/src/main/java/freemarker/core/_Java8Impl.java @@ -22,7 +22,7 @@ import java.lang.reflect.Method; /** * Used internally only, might changes without notice! - * Used for accessing functionality that's only present in Java 6 or later. + * Used for accessing functionality that's only present in Java 8 or later. */ // Compile this against Java 8 @SuppressWarnings("Since15") // For IntelliJ inspection http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7b35587e/src/main/java/freemarker/template/TemplateNodeModelEx.java -- diff --git a/src/main/java/freemarker/template/TemplateNodeModelEx.java b/src/main/java/freemarker/template/TemplateNodeModelEx.java index 16ef7d0..4d5f905 100644 --- a/src/main/java/freemarker/template/TemplateNodeModelEx.java +++ b/src/main/java/freemarker/template/TemplateNodeModelEx.java @@ -19,10 +19,8 @@ package freemarker.template; -import freemarker.ext.dom.NodeModel; - /** - * A {@link NodeModel} that supports navigating to the previous and next sibling nodes. + * A {@link TemplateNodeModel} that supports navigating to the previous and next sibling nodes. * * @since 2.3.26 */
[23/50] incubator-freemarker git commit: Improved #attempt error reporting:
Improved #attempt error reporting: - Added new configuration setting, attempt_exception_reporter (Configurable.setAttemptExceptionReporter(AttemptExceptionReporter)), to allow the customization of how the exceptions handled (and thus suppressed) by the "attempt" directive are reported. The default AttemptExceptionReporter logs the exception as an error, just as it was in earlier versions, though now the error message will indicate that the exception was thrown inside an attempt directive block. - Bug fixed: When the TemplateExceptionHandler suppresses (i.e., doesn't re-throw) an exception, the attempt directive won't log it anymore. (To be precise, the AttemptExceptionReporter won't be invoked for it anymore; the default one logs as error.) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/304df82a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/304df82a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/304df82a Branch: refs/heads/2.3 Commit: 304df82a7501f66386b2c5be740d377961f93dc5 Parents: 4b5b7e8 Author: ddekany Authored: Wed Jun 28 01:42:10 2017 +0200 Committer: ddekany Committed: Wed Jun 28 01:42:26 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 107 --- src/main/java/freemarker/core/Environment.java | 27 +++-- .../freemarker/core/TemplateConfiguration.java | 7 ++ .../template/AttemptExceptionReporter.java | 48 + .../java/freemarker/template/Configuration.java | 45 .../LoggingAttemptExceptionReporter.java| 29 + .../template/TemplateExceptionHandler.java | 8 +- .../java/freemarker/template/_TemplateAPI.java | 5 + src/manual/en_US/book.xml | 66 +--- .../freemarker/core/AttemptLoggingTest.java | 77 + .../core/TemplateConfigurationTest.java | 2 + .../freemarker/template/ConfigurationTest.java | 12 +++ 12 files changed, 392 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/304df82a/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 914015a..9084956 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -52,6 +52,7 @@ import freemarker.cache.PathRegexMatcher; import freemarker.cache.TemplateLoader; import freemarker.ext.beans.BeansWrapper; import freemarker.ext.beans.BeansWrapperBuilder; +import freemarker.template.AttemptExceptionReporter; import freemarker.template.Configuration; import freemarker.template.DefaultObjectWrapper; import freemarker.template.ObjectWrapper; @@ -162,6 +163,13 @@ public class Configurable { /** Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints. */ public static final String TEMPLATE_EXCEPTION_HANDLER_KEY = TEMPLATE_EXCEPTION_HANDLER_KEY_SNAKE_CASE; +/** Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.27 */ +public static final String ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE = "attempt_exception_reporter"; +/** Modern, camel case ({@code likeThis}) variation of the setting name. @since 2.3.27 */ +public static final String ATTEMPT_EXCEPTION_REPORTER_KEY_CAMEL_CASE = "attemptExceptionReporter"; +/** Alias to the {@code ..._SNAKE_CASE} variation due to backward compatibility constraints. */ +public static final String ATTEMPT_EXCEPTION_REPORTER_KEY = ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE; + /** Legacy, snake case ({@code like_this}) variation of the setting name. @since 2.3.23 */ public static final String ARITHMETIC_ENGINE_KEY_SNAKE_CASE = "arithmetic_engine"; /** Modern, camel case ({@code likeThis}) variation of the setting name. @since 2.3.23 */ @@ -275,6 +283,7 @@ public class Configurable { // Must be sorted alphabetically! API_BUILTIN_ENABLED_KEY_SNAKE_CASE, ARITHMETIC_ENGINE_KEY_SNAKE_CASE, +ATTEMPT_EXCEPTION_REPORTER_KEY_SNAKE_CASE, AUTO_FLUSH_KEY_SNAKE_CASE, AUTO_IMPORT_KEY_SNAKE_CASE, AUTO_INCLUDE_KEY_SNAKE_CASE, @@ -305,6 +314,7 @@ public class Configurable { // Must be sorted alphabetically! API_BUILTIN_ENABLED_KEY_CAMEL_CASE, ARITHMETIC_ENGINE_KEY_CAMEL_CASE, +ATTEMPT_EXCEPTION_REPORTER_KEY_CAMEL_CASE, AUTO_FLUSH_KEY_CAMEL_CASE, AUTO_IMPORT_KEY_CAMEL_CASE, AUTO_INCLUDE_KEY_CAMEL_CASE, @@ -348,6 +358,7 @@ public class Configurable { private String falseSt
[36/50] incubator-freemarker git commit: (Switch parsing cleanup)
(Switch parsing 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/3b034066 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3b034066 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3b034066 Branch: refs/heads/2.3 Commit: 3b0340661d218a77e2422aed1a73bec1e09b8292 Parents: 507ba1f Author: ddekany Authored: Mon Jul 24 19:50:34 2017 +0200 Committer: ddekany Committed: Mon Jul 24 19:50:34 2017 +0200 -- src/main/javacc/FTL.jj | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3b034066/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index 385bbea..6bd358e 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3601,21 +3601,22 @@ SwitchBlock Switch() : breakableDirectiveNesting++; switchBlock = new SwitchBlock(switchExp, ignoredSectionBeforeFirstCase); } -( -LOOKAHEAD(2) -caseIns = Case() -{ -if (caseIns.condition == null) { -if (defaultFound) { -throw new ParseException( -"You can only have one default case in a switch statement", template, start); -} -defaultFound = true; -} -switchBlock.addCase(caseIns); -} -)* -[] +[ + ( + caseIns = Case() + { + if (caseIns.condition == null) { + if (defaultFound) { + throw new ParseException( + "You can only have one default case in a switch statement", template, start); + } + defaultFound = true; + } + switchBlock.addCase(caseIns); + } + )+ + [] +] end = { breakableDirectiveNesting--;
[49/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/67691b4c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/67691b4c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/67691b4c Branch: refs/heads/2.3 Commit: 67691b4c62d51998f5eb86f77bdaa24a98c10725 Parents: c688e15 Author: ddekany Authored: Sat Aug 5 13:11:23 2017 +0200 Committer: ddekany Committed: Sat Aug 5 13:11:23 2017 +0200 -- .travis.yml | 6 +- build.xml | 14 +- 2 files changed, 6 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 5e1f7ca..3a560ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: java -install: ant download-ivy download-ant-junit +before_install: +- sudo apt-get -qq update +# ant-optional is needed for ant junit +- sudo apt-get install ant-optional +install: ant download-ivy script: ant ci jdk: - oraclejdk8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/build.xml -- diff --git a/build.xml b/build.xml index 4f45785..88deeea 100644 --- a/build.xml +++ b/build.xml @@ -140,18 +140,6 @@ https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"; dest="${ivy.jar.file}" usetimestamp="true"/> - - - - - - - - - -https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"; - dest="${ant-junit.jar.file}" usetimestamp="true"/> - @@ -460,7 +448,7 @@ - +
[05/50] incubator-freemarker git commit: Various smaller JavaDoc fixes
Various smaller JavaDoc fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/62e26785 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/62e26785 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/62e26785 Branch: refs/heads/2.3 Commit: 62e267859b0db0d23a0be7a7e2f348dcaef1fed0 Parents: 6ac622e Author: ddekany Authored: Fri Apr 14 14:28:08 2017 +0200 Committer: ddekany Committed: Fri Apr 14 14:28:08 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 39 ++-- 1 file changed, 20 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/62e26785/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 16beca8..3aff2a6 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -684,7 +684,7 @@ public class Configurable { /** * Sets the time zone used when dealing with {@link java.sql.Date java.sql.Date} and * {@link java.sql.Time java.sql.Time} values. It defaults to {@code null} for backward compatibility, but in most - * application this should be set to the JVM default time zone (server default time zone), because that's what + * applications this should be set to the JVM default time zone (server default time zone), because that's what * most JDBC drivers will use when constructing the {@link java.sql.Date java.sql.Date} and * {@link java.sql.Time java.sql.Time} values. If this setting is {@code null}, FreeMarker will use the value of * ({@link #getTimeZone()}) for {@link java.sql.Date java.sql.Date} and {@link java.sql.Time java.sql.Time} values, @@ -695,7 +695,7 @@ public class Configurable { * * To decide what value you need, a few things has to be understood: * - * Date-only and time-only values in SQL-oriented databases are usually store calendar and clock field + * Date-only and time-only values in SQL-oriented databases usually store calendar and clock field * values directly (year, month, day, or hour, minute, seconds (with decimals)), as opposed to a set of points * on the physical time line. Thus, unlike SQL timestamps, these values usually aren't meant to be shown * differently depending on the time zone of the audience. @@ -709,7 +709,7 @@ public class Configurable { * Then, 2014-07-12 in the database will be translated to physical time 2014-07-11 22:00:00 UTC, because that * rendered in GMT+02:00 gives 2014-07-12 00:00:00. Similarly, 11:57:00 in the database will be translated to * physical time 1970-01-01 09:57:00 UTC. Thus, the physical time stored in the returned value depends on the - * default system time zone of the JDBC client, not just on the content in the database. (This used to be the + * default system time zone of the JDBC client, not just on the content of the database. (This used to be the * default behavior of ORM-s, like Hibernate, too.) * * The value of the {@code time_zone} FreeMarker configuration setting sets the time zone used for the @@ -725,11 +725,12 @@ public class Configurable { * values from the earlier examples will be shown as 2014-07-11 (one day off) and 09:57:00 (2 hours off). While * those are the time zone correct renderings, those values are probably meant to be shown "as is". * - * You may wonder why this setting isn't simply "SQL time zone", since the time zone related behavior of JDBC - * applies to {@link java.sql.Timestamp java.sql.Timestamp} too. FreeMarker assumes that you have set up your - * application so that time stamps coming from the database go through the necessary conversion to store the - * correct distance from the epoch (1970-01-01 00:00:00 UTC), as requested by {@link java.util.Date}. In that case - * the time stamp can be safely rendered in different time zones, and thus it needs no special treatment. + * You may wonder why this setting isn't simply "SQL time zone", that is, why's this time zone not applied to + * {@link java.sql.Timestamp java.sql.Timestamp} values as well. Timestamps in databases refer to a point on + * the physical time line, and thus doesn't have the inherent problem of date-only and time-only values. + * FreeMarker assumes that the JDBC driver converts time stamps coming from the database so that they store + * the distance from the epoch (1970-01-01 00:00:00 UTC)
[21/50] incubator-freemarker git commit: FREEMARKER-58: Manual example mistakes
FREEMARKER-58: Manual example mistakes Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/367560fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/367560fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/367560fe Branch: refs/heads/2.3 Commit: 367560fecfbbc2733c97f95b4d9afc8ab1431bbf Parents: dc3277e Author: ddekany Authored: Tue Jun 13 18:57:52 2017 +0200 Committer: ddekany Committed: Tue Jun 13 18:57:52 2017 +0200 -- src/manual/en_US/book.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/367560fe/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 3f003b3..77b13cd 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -5151,9 +5151,9 @@ ot...@example.com namespace parameter: <#import "/lib/example.ftl" as e> -${my.mail} +${e.mail} <#assign mail="ot...@example.com" in e> -${my.mail} +${e.mail} u...@example.com ot...@example.com @@ -5218,7 +5218,7 @@ User is: ${user} <#import "/lib/example.ftl" as e2> <#import "/lib/example.ftl" as e3> ${e.mail}, ${e2.mail}, ${e3.mail} -<#assign mail="ot...@example.com" in my> +<#assign mail="ot...@example.com" in e> ${e.mail}, ${e2.mail}, ${e3.mail} u...@example.com, u...@example.com, u...@example.com
[24/50] incubator-freemarker git commit: Added alternative syntaxes for the && (logical and) operator: \and and & & . These are to work around issues in applications where the template must be
Added alternative syntaxes for the && (logical and) operator: \and and &&. These are to work around issues in applications where the template must be a valid XML (&& is not valid XML/HTML, at most places), or where the template entered is stored after XML or HTML escaping. Note that lonely &, and `and` without \ is not recognized for backward compatibility. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f933ed03 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f933ed03 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f933ed03 Branch: refs/heads/2.3 Commit: f933ed03db875aa1f550e091339da6469e8cd6ba Parents: 304df82 Author: ddekany Authored: Wed Jun 28 11:29:28 2017 +0200 Committer: ddekany Committed: Wed Jun 28 11:29:28 2017 +0200 -- src/main/javacc/FTL.jj | 2 +- src/manual/en_US/book.xml | 94 +++- .../test/templatesuite/templates/boolean.ftl| 4 + 3 files changed, 77 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f933ed03/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index c6a9d8b..75c7784 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -1251,7 +1251,7 @@ TOKEN: | | - + | | http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f933ed03/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index a4d63a1..05435b0 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -3457,30 +3457,29 @@ ${12 % -5} <#-- Prints 2 --> <#if (x > y)>, although it's considered to be less elegant. - -FreeMarker supports some other alternatives too, but these -are deprecated: + FreeMarker supports some more syntactical alternatives: - - -Writing > and -< on the place of the problematic -relation marks, like in: <#if x > -y> or <#if x >= -y> . Note that in general FTL does not support -entity references (the -&...; -things) in FTL tags; it's just an exception with the -arithmetical comparisons. - + + + > and + < can also be used, like in: + <#if x > y> or <#if + x >= y>. This isn't meant to be entered + manually; it's to work around cases where the template gets + XML/HTML escaped and the user can't easily prevent that + happening. Note that in general FTL does not support entity + references (the + &...; things) + in FTL tags; it's just an exception with these operators. + - -\lt, \lte, -\gt and \gte which are -the same as the ones without the backslash - - - + + Deprecated forms: \lt, + \lte, \gt and + \gte. These are the same as the ones without + the backslash. + + @@ -3535,6 +3534,38 @@ ${12 % -5} <#-- Prints 2 --> <#if !hot> <#-- here hot must be a boolean --> It's not hot. #if> + + FreeMarker supports some more syntactical alternatives: + + + + \and (since FreeMarker 2.3.27): In some + applications using && causes problems + as it's not valid in XML or HTML. While FreeMarker templates was + never intended to be valid XML/HTML, only their output should be + that, in reality there are some applications that expect the + template itself to be valid XML/HTML regardless. This syntax is + a workaround for such cases. Also note that unlike with the + comparison operators, and without + \ is not supported due to backward + compatibility restrictions. + + + + && (since FreeMarker + 2.3.27): This isn't meant to be entered manually; it's to work + around cases where the template gets XML/HTML escaped and the + user can't easily prevent that happening. Note that in general + FTL does not support entity references (the +
[42/50] incubator-freemarker git commit: GeneralPurposeNothing also implements TemplateHashModelEx2
GeneralPurposeNothing also implements TemplateHashModelEx2 Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/889b8a96 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/889b8a96 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/889b8a96 Branch: refs/heads/2.3 Commit: 889b8a965a19588037a90aadf5c58d51386520ec Parents: 2aebfe5 Author: ddekany Authored: Sat Aug 5 11:16:38 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:16:38 2017 +0200 -- .../freemarker/template/GeneralPurposeNothing.java | 15 +-- src/manual/en_US/book.xml| 8 +--- 2 files changed, 14 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/src/main/java/freemarker/template/GeneralPurposeNothing.java -- diff --git a/src/main/java/freemarker/template/GeneralPurposeNothing.java b/src/main/java/freemarker/template/GeneralPurposeNothing.java index 7ba8602..8023bd8 100644 --- a/src/main/java/freemarker/template/GeneralPurposeNothing.java +++ b/src/main/java/freemarker/template/GeneralPurposeNothing.java @@ -19,9 +19,10 @@ package freemarker.template; -import java.util.ArrayList; import java.util.List; +import freemarker.template.utility.Constants; + /** * Singleton object representing nothing, used by ?if_exists built-in. * It is meant to be interpreted in the most sensible way possible in various contexts. @@ -29,11 +30,9 @@ import java.util.List; */ final class GeneralPurposeNothing -implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx, TemplateMethodModelEx { +implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx2, TemplateMethodModelEx { private static final TemplateModel instance = new GeneralPurposeNothing(); - -private static final TemplateCollectionModel EMPTY_COLLECTION = new SimpleCollection(new ArrayList(0)); private GeneralPurposeNothing() { } @@ -71,10 +70,14 @@ implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, Tem } public TemplateCollectionModel keys() { -return EMPTY_COLLECTION; +return Constants.EMPTY_COLLECTION; } public TemplateCollectionModel values() { -return EMPTY_COLLECTION; +return Constants.EMPTY_COLLECTION; +} + +public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException { +return Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR; } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 1288f8a..6d6d6f9 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26982,10 +26982,12 @@ TemplateModel x = env.getVariable("x"); // get variable x - Constants.EMPTY_HASH now implements + Constants.EMPTY_HASH and + GeneralPurposeNothing (the value of + missingVar!) now implements TemplateHashModelEx2, so it can be listed - with <#list ... as k, v>. Earlier it - was only a TemplateHashModelEx. + with <#list ... as k, v>. Earlier they + were only a TemplateHashModelEx-s.
[29/50] incubator-freemarker git commit: Build: Fixed Maven SNAPSHOT deployment (all artifacts use the same build number now). Added "maven-install" task for local installation.
Build: Fixed Maven SNAPSHOT deployment (all artifacts use the same build number now). Added "maven-install" task for local installation. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/9b3d130a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9b3d130a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9b3d130a Branch: refs/heads/2.3 Commit: 9b3d130acd1f87c11f139b60e45b9b3e809eb5b1 Parents: 96d3971 Author: ddekany Authored: Sat Jul 8 00:50:24 2017 +0200 Committer: ddekany Committed: Sat Jul 8 00:50:24 2017 +0200 -- build.xml | 39 ++- 1 file changed, 14 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b3d130a/build.xml -- diff --git a/build.xml b/build.xml index 5b030bf..32e4168 100644 --- a/build.xml +++ b/build.xml @@ -892,7 +892,16 @@ ]]> - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - + + * Check the above lines for any Maven errors! Now you need to close and maybe release the staged repo on -http://repository.apache.org. +http://repository.apache.org (except for SNAPSHOT versions). Note that before releasing, voting is needed! *
[07/50] incubator-freemarker git commit: Added "ci" Ant task
Added "ci" Ant task Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/7295c65f Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7295c65f Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7295c65f Branch: refs/heads/2.3 Commit: 7295c65f9b3784423a0361dafc9a6c98deb1de66 Parents: 9a60974 Author: ddekany Authored: Mon Apr 17 11:39:03 2017 +0200 Committer: ddekany Committed: Mon Apr 17 11:39:03 2017 +0200 -- build.xml | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7295c65f/build.xml -- diff --git a/build.xml b/build.xml index 861a1b5..11772d1 100644 --- a/build.xml +++ b/build.xml @@ -146,7 +146,6 @@ - Note that before releasing, voting is needed! * - + + + + + +
[46/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/13ddf646 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/13ddf646 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/13ddf646 Branch: refs/heads/2.3 Commit: 13ddf6462ad9f9c6d162202ba5e3af29343e4f08 Parents: b9978ed Author: ddekany Authored: Sat Aug 5 12:24:10 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:24:10 2017 +0200 -- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/13ddf646/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c0493be..5e1f7ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -install: ant download-ivy download-junit +install: ant download-ivy download-ant-junit script: ant ci jdk: - oraclejdk8 \ No newline at end of file
[33/50] incubator-freemarker git commit: Legacy <#call m> haven't set the source code position of m.
Legacy <#call m> haven't set the source code position of m. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/6f0283d7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/6f0283d7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/6f0283d7 Branch: refs/heads/2.3 Commit: 6f0283d72847aca5d53277c4659c2f1275c7c667 Parents: 1dba510 Author: ddekany Authored: Sun Jul 9 00:36:18 2017 +0200 Committer: ddekany Committed: Sun Jul 9 00:38:26 2017 +0200 -- src/main/javacc/FTL.jj | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6f0283d7/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index fb6106d..385bbea 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3432,11 +3432,14 @@ TemplateElement Call() : Token start, end, id; HashMap namedArgs = null; ArrayList positionalArgs = null; -String macroName= null; +Identifier macroName= null; } { start = -id = { macroName = id.image; } +id = { +macroName = new Identifier(id.image); +macroName.setLocation(template, id, id); +} ( LOOKAHEAD() namedArgs = NamedArgs() @@ -3454,9 +3457,9 @@ TemplateElement Call() : { UnifiedCall result = null; if (positionalArgs != null) { -result = new UnifiedCall(new Identifier(macroName), positionalArgs, TemplateElements.EMPTY, null); +result = new UnifiedCall(macroName, positionalArgs, TemplateElements.EMPTY, null); } else { -result = new UnifiedCall(new Identifier(macroName), namedArgs, TemplateElements.EMPTY, null); +result = new UnifiedCall(macroName, namedArgs, TemplateElements.EMPTY, null); } result.legacySyntax = true; result.setLocation(template, start, end);
[50/50] incubator-freemarker git commit: Merge remote-tracking branch 'origin/2.3-gae' into 2.3
Merge remote-tracking branch 'origin/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/a5fb3511 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a5fb3511 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a5fb3511 Branch: refs/heads/2.3 Commit: a5fb3511f13dbf6fb20ea85de120a2e8bb6175fe Parents: bfb836b 67691b4 Author: ddekany Authored: Sat Aug 5 16:23:16 2017 +0200 Committer: ddekany Committed: Sat Aug 5 16:23:16 2017 +0200 -- .travis.yml | 9 + README | 234 -- README.md | 223 + build.xml | 74 ++--- .../freemarker/cache/TemplateNameFormat.java| 4 +- .../java/freemarker/core/ArithmeticEngine.java | 8 +- .../java/freemarker/core/BlockAssignment.java | 84 ++--- .../core/BuiltInsForMultipleTypes.java | 2 +- src/main/java/freemarker/core/Case.java | 4 +- src/main/java/freemarker/core/Configurable.java | 174 +++--- src/main/java/freemarker/core/Environment.java | 45 ++- src/main/java/freemarker/core/IfBlock.java | 2 +- .../java/freemarker/core/NumericalOutput.java | 4 +- src/main/java/freemarker/core/SwitchBlock.java | 31 +- .../freemarker/core/TemplateConfiguration.java | 15 +- .../java/freemarker/core/TemplateElement.java | 11 +- .../java/freemarker/core/TemplateObject.java| 3 - src/main/java/freemarker/core/TextBlock.java| 4 +- .../java/freemarker/core/TrimInstruction.java | 8 +- src/main/java/freemarker/core/_CoreAPI.java | 4 + src/main/java/freemarker/core/_Java8Impl.java | 2 +- .../core/_ObjectBuilderSettingEvaluator.java| 3 +- .../java/freemarker/ext/beans/BeansWrapper.java | 2 +- .../template/AttemptExceptionReporter.java | 48 +++ .../java/freemarker/template/Configuration.java | 91 +- .../template/GeneralPurposeNothing.java | 15 +- .../LoggingAttemptExceptionReporter.java| 29 ++ src/main/java/freemarker/template/Template.java | 14 +- .../template/TemplateExceptionHandler.java | 8 +- .../template/TemplateNodeModelEx.java | 4 +- .../java/freemarker/template/_TemplateAPI.java | 9 + .../freemarker/template/utility/Constants.java | 36 ++- src/main/javacc/FTL.jj | 136 ++-- .../resources/freemarker/version.properties | 11 +- src/manual/en_US/book.xml | 324 +++ .../freemarker/core/AttemptLoggingTest.java | 77 + .../core/CapturingAssignmentTest.java | 55 .../core/ParsingErrorMessagesTest.java | 2 + .../core/TemplateConfigurationTest.java | 2 + .../freemarker/template/ConfigurationTest.java | 12 + .../template/DefaultObjectWrapperTest.java | 1 + .../template/utility/ConstantsTest.java | 21 ++ .../freemarker/core/ast-strlitinterpolation.ast | 4 +- .../test/templatesuite/expected/switch.txt | 2 + .../test/templatesuite/templates/boolean.ftl| 4 + .../test/templatesuite/templates/switch.ftl | 3 + 46 files changed, 1296 insertions(+), 562 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/build.xml -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/java/freemarker/core/TemplateElement.java -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/java/freemarker/template/Template.java -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5fb3511/src/main/resources/freemarker/version.properties --
[37/50] incubator-freemarker git commit: (Bit of jj code formatting)
(Bit of jj code formatting) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/77e877c7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/77e877c7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/77e877c7 Branch: refs/heads/2.3 Commit: 77e877c7657c404d78d2f968273fd05160b9df89 Parents: 3b03406 Author: ddekany Authored: Thu Jul 27 18:51:28 2017 +0200 Committer: ddekany Committed: Thu Jul 27 18:51:28 2017 +0200 -- src/main/javacc/FTL.jj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/77e877c7/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index 6bd358e..b011c41 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3360,12 +3360,13 @@ TemplateElement UnifiedMacroTransform() : positionalArgs = PositionalArgs() ) [ -{bodyParameters = new ArrayList(4); } + +{ bodyParameters = new ArrayList(4); } [ [] t = { bodyParameters.add(t.image); } ( [] -[] t = {bodyParameters.add(t.image); } +[] t = {bodyParameters.add(t.image); } )* ] ]
[22/50] incubator-freemarker git commit: Minor JavaDoc improvements
Minor JavaDoc improvements Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4b5b7e87 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4b5b7e87 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4b5b7e87 Branch: refs/heads/2.3 Commit: 4b5b7e8715359effbc39990c01305b9703abf90f Parents: 367560f Author: ddekany Authored: Fri Jun 23 21:06:16 2017 +0200 Committer: ddekany Committed: Fri Jun 23 21:06:16 2017 +0200 -- src/main/java/freemarker/core/IfBlock.java | 2 +- src/main/java/freemarker/core/TemplateElement.java | 11 ++- src/main/java/freemarker/core/TemplateObject.java| 3 --- src/main/java/freemarker/ext/beans/BeansWrapper.java | 2 +- src/main/java/freemarker/template/Configuration.java | 10 -- src/main/java/freemarker/template/Template.java | 5 - 6 files changed, 20 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/IfBlock.java -- diff --git a/src/main/java/freemarker/core/IfBlock.java b/src/main/java/freemarker/core/IfBlock.java index f61e2d3..223d755 100644 --- a/src/main/java/freemarker/core/IfBlock.java +++ b/src/main/java/freemarker/core/IfBlock.java @@ -25,7 +25,7 @@ import freemarker.template.TemplateException; /** * Container for a group of related #if, #elseif and #else elements. - * Each such block is a nested {@link ConditionalBlock}. Note that if an #if has no #else of #elseif, + * Each such block is a nested {@link ConditionalBlock}. Note that if an #if has no #else or #elseif, * {@link ConditionalBlock} doesn't need this parent element. */ final class IfBlock extends TemplateElement { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/TemplateElement.java -- diff --git a/src/main/java/freemarker/core/TemplateElement.java b/src/main/java/freemarker/core/TemplateElement.java index f63db63..a8dedea 100644 --- a/src/main/java/freemarker/core/TemplateElement.java +++ b/src/main/java/freemarker/core/TemplateElement.java @@ -77,11 +77,12 @@ abstract public class TemplateElement extends TemplateObject { abstract TemplateElement[] accept(Environment env) throws TemplateException, IOException; /** - * One-line description of the element, that contain all the information that is used in {@link #getCanonicalForm()} - * , except the nested content (elements) of the element. The expressions inside the element (the parameters) has to - * be shown. Meant to be used for stack traces, also for tree views that don't go down to the expression-level. - * There are no backward-compatibility guarantees regarding the format used ATM, but it must be regular enough to be - * machine-parseable, and it must contain all information necessary for restoring an AST equivalent to the original. + * One-line description of the element, that contains all the information that is used in + * {@link #getCanonicalForm()}, except the nested content (elements) of the element. The expressions inside the + * element (the parameters) has to be shown. Meant to be used for stack traces, also for tree views that don't go + * down to the expression-level. There are no backward-compatibility guarantees regarding the format used ATM, but + * it must be regular enough to be machine-parseable, and it must contain all information necessary for restoring an + * AST equivalent to the original. * * This final implementation calls {@link #dump(boolean) dump(false)}. * http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b5b7e87/src/main/java/freemarker/core/TemplateObject.java -- diff --git a/src/main/java/freemarker/core/TemplateObject.java b/src/main/java/freemarker/core/TemplateObject.java index 87ee274..248395d 100644 --- a/src/main/java/freemarker/core/TemplateObject.java +++ b/src/main/java/freemarker/core/TemplateObject.java @@ -198,9 +198,6 @@ public abstract class TemplateObject { * that is equivalent with the original could be reconstructed from the tree view. Thus, for literal values that are * leaf nodes the symbols should be the canonical form of value. * - * Note that {@link TemplateElement#getDescription()} has similar role, only it doesn't go under the element level - * (i.e. down to the expression level), instead it always prints the embedded expressions itself. - * * @see #getCanonicalForm() * @see T
[02/50] incubator-freemarker git commit: Converted the README from plain txt to markdown, and added the build status from Travis
Converted the README from plain txt to markdown, and added the build status from Travis Merge commit 'refs/pull/21/head' of https://github.com/apache/incubator-freemarker into 2.3-gae Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/fef04d8c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/fef04d8c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/fef04d8c Branch: refs/heads/2.3 Commit: fef04d8cd64966face55efb1b4cb1e4748a798c1 Parents: 93dea88 f871237 Author: ddekany Authored: Thu Apr 13 14:34:04 2017 +0200 Committer: ddekany Committed: Thu Apr 13 14:41:32 2017 +0200 -- README| 237 README.md | 256 + build.xml | 10 +-- 3 files changed, 260 insertions(+), 243 deletions(-) --
[25/50] incubator-freemarker git commit: Fixed wrong test
Fixed wrong test Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/387dcd44 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/387dcd44 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/387dcd44 Branch: refs/heads/2.3 Commit: 387dcd44ff8f0c56f9c4c6508025c2a68e54ea14 Parents: f933ed0 Author: ddekany Authored: Wed Jun 28 15:22:37 2017 +0200 Committer: ddekany Committed: Wed Jun 28 15:22:37 2017 +0200 -- .../freemarker/test/templatesuite/templates/boolean.ftl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/387dcd44/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl -- diff --git a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl index a76d9b9..49816ee 100644 --- a/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl +++ b/src/test/resources/freemarker/test/templatesuite/templates/boolean.ftl @@ -71,9 +71,9 @@ <#else> boolean4 && boolean5 failed. -<@assert test=boolean4 && boolean5 /> +<@assert test=true && true /> <@assert test=!(false && true) /> -<@assert test=boolean4 \and boolean5 /> +<@assert test=true \and true /> <@assert test=!(false \and true) /> Now test list models:
[48/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c688e15c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c688e15c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c688e15c Branch: refs/heads/2.3 Commit: c688e15c7049d61523a709c43e0a6bd7b8df59dd Parents: c2fcbc8 Author: ddekany Authored: Sat Aug 5 12:41:55 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:41:55 2017 +0200 -- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c688e15c/build.xml -- diff --git a/build.xml b/build.xml index 7f5b57a..4f45785 100644 --- a/build.xml +++ b/build.xml @@ -142,7 +142,8 @@ - + +
[28/50] incubator-freemarker git commit: FREEMARKER-60: Document interaction between lazy import and #global
FREEMARKER-60: Document interaction between lazy import and #global Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/96d3971c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/96d3971c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/96d3971c Branch: refs/heads/2.3 Commit: 96d3971cc6f21974729f4fc0a7dec159b5a4ff42 Parents: 5d81db7 Author: ddekany Authored: Tue Jul 4 21:05:06 2017 +0200 Committer: ddekany Committed: Tue Jul 4 21:05:06 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/96d3971c/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 4887dfe..492282a 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -1703,16 +1703,20 @@ public class Configurable { /** * Specifies if {@code <#import ...>} (and {@link Environment#importLib(String, String)}) should delay the loading * and processing of the imported templates until the content of the imported namespace is actually accessed. This - * makes the overhead of unused imports negligible. A drawback is that importing a missing or otherwise - * broken template will be successful, and the problem will remain hidden until (and if) the namespace content is - * actually used. Also, you lose the strict control over when the namespace initializing code in the imported - * template will be executed, though it shouldn't mater for well written imported templates anyway. Note that the - * namespace initializing code will run with the same {@linkplain Configurable#getLocale() locale} as it was at the - * point of the {@code <#import ...>} call (other settings won't be handled specially like that). + * makes the overhead of unused imports negligible. Note that turning on lazy importing isn't entirely + * transparent, as accessing global variables (usually created with {@code <#global ...=...>}) that should be + * created by the imported template won't trigger the loading and processing of the lazily imported template + * (because globals aren't accessed through the namespace variable), so the global variable will just be missing. + * In general, you lose the strict control over when the namespace initializing code in the imported template will + * be executed, though it shouldn't mater for most well designed imported templates. + * Another drawback is that importing a missing or otherwise broken template will be successful, and the problem + * will remain hidden until (and if) the namespace content is actually used. Note that the namespace initializing + * code will run with the same {@linkplain Configurable#getLocale() locale} as it was at the point of the + * {@code <#import ...>} call (other settings won't be handled specially like that). * * * The default is {@code false} (and thus imports are eager) for backward compatibility, which can cause - * perceivable overhead if you have many imports and only a few of them is used. + * perceivable overhead if you have many imports and only a few of them is actually used. * * * This setting also affects {@linkplain #setAutoImports(Map) auto-imports}, unless you have set a non-{@code null}
[04/50] incubator-freemarker git commit: REAMDE needs no copyright header
REAMDE needs no copyright header Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/6ac622ef Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/6ac622ef Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/6ac622ef Branch: refs/heads/2.3 Commit: 6ac622ef24ec502f0a38c59848f095afa0401d05 Parents: 36fdc7c Author: ddekany Authored: Fri Apr 14 14:27:38 2017 +0200 Committer: ddekany Committed: Fri Apr 14 14:27:38 2017 +0200 -- README.md | 20 1 file changed, 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6ac622ef/README.md -- diff --git a/README.md b/README.md index e4ad314..e460531 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,3 @@ -``` - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -``` - - Apache FreeMarker {version} ===
[35/50] incubator-freemarker git commit: Constants.EMPTY_HASH now implements TemplateHashModelEx2, so it can be listed with <#list ... as k, v>. Earlier it was only a TemplateHashModelEx. Added Consta
Constants.EMPTY_HASH now implements TemplateHashModelEx2, so it can be listed with <#list ... as k, v>. Earlier it was only a TemplateHashModelEx. Added Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/507ba1f4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/507ba1f4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/507ba1f4 Branch: refs/heads/2.3 Commit: 507ba1f4b73da433c3f3aa0176211fcc21713a42 Parents: c3672d9 Author: ddekany Authored: Sun Jul 23 11:18:34 2017 +0200 Committer: ddekany Committed: Sun Jul 23 11:18:34 2017 +0200 -- .../freemarker/template/utility/Constants.java | 36 +++- src/manual/en_US/book.xml | 12 +++ .../template/utility/ConstantsTest.java | 21 3 files changed, 68 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/src/main/java/freemarker/template/utility/Constants.java -- diff --git a/src/main/java/freemarker/template/utility/Constants.java b/src/main/java/freemarker/template/utility/Constants.java index ac948a9..fd48e70 100644 --- a/src/main/java/freemarker/template/utility/Constants.java +++ b/src/main/java/freemarker/template/utility/Constants.java @@ -20,11 +20,14 @@ package freemarker.template.utility; import java.io.Serializable; +import java.util.NoSuchElementException; import freemarker.template.SimpleNumber; import freemarker.template.TemplateBooleanModel; import freemarker.template.TemplateCollectionModel; import freemarker.template.TemplateHashModelEx; +import freemarker.template.TemplateHashModelEx2; +import freemarker.template.TemplateHashModelEx2.KeyValuePairIterator; import freemarker.template.TemplateModel; import freemarker.template.TemplateModelException; import freemarker.template.TemplateModelIterator; @@ -95,7 +98,11 @@ public class Constants { public static final TemplateHashModelEx EMPTY_HASH = new EmptyHashModel(); -private static class EmptyHashModel implements TemplateHashModelEx, Serializable { +/** + * An empty hash. Since 2.3.27, it implements {@link TemplateHashModelEx2}, before that it was only + * {@link TemplateHashModelEx}. + */ +private static class EmptyHashModel implements TemplateHashModelEx2, Serializable { public int size() throws TemplateModelException { return 0; @@ -116,7 +123,34 @@ public class Constants { public boolean isEmpty() throws TemplateModelException { return true; } + +public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException { +return EMPTY_KEY_VALUE_PAIR_ITERATOR; +} } +/** + * @since 2.3.27 + */ +public static final KeyValuePairIterator EMPTY_KEY_VALUE_PAIR_ITERATOR = EmptyKeyValuePairIterator.INSTANCE; + +private static class EmptyKeyValuePairIterator implements TemplateHashModelEx2.KeyValuePairIterator { + +static final EmptyKeyValuePairIterator INSTANCE = new EmptyKeyValuePairIterator(); + +private EmptyKeyValuePairIterator() { +// +} + +public boolean hasNext() throws TemplateModelException { +return false; +} + +public TemplateHashModelEx2.KeyValuePair next() throws TemplateModelException { +throw new NoSuchElementException("Can't retrieve element from empty key-value pair iterator."); +} + +} + } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 3897385..e072d1a 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26966,6 +26966,18 @@ TemplateModel x = env.getVariable("x"); // get variable x output_format=freemarker.core.XHTMLOutputFormat() did). + + + Constants.EMPTY_HASH now implements + TemplateHashModelEx2, so it can be listed + with <#list ... as k, v>. Earlier it + was only a TemplateHashModelEx. + + + + Added + Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/507ba1f4/src/test/java/freemarker/template/utility/ConstantsTest.java -- diff --git a/
[47/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c2fcbc8d Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c2fcbc8d Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c2fcbc8d Branch: refs/heads/2.3 Commit: c2fcbc8dd55dfc95538a23b8a34b9df9fb7c3ea2 Parents: 13ddf64 Author: ddekany Authored: Sat Aug 5 12:38:00 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:38:00 2017 +0200 -- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c2fcbc8d/build.xml -- diff --git a/build.xml b/build.xml index 1e7e340..7f5b57a 100644 --- a/build.xml +++ b/build.xml @@ -141,7 +141,8 @@ dest="${ivy.jar.file}" usetimestamp="true"/> - + +
[15/50] incubator-freemarker git commit: (Some JavaDoc and error message typos fixed)
(Some JavaDoc and error message typos fixed) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a5668475 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a5668475 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a5668475 Branch: refs/heads/2.3 Commit: a5668475024251cdbba7aeda9277247f2898341b Parents: a4273fc Author: ddekany Authored: Sat Apr 22 12:59:23 2017 +0200 Committer: ddekany Committed: Sat Apr 22 12:59:23 2017 +0200 -- src/main/java/freemarker/template/Configuration.java | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a5668475/src/main/java/freemarker/template/Configuration.java -- diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java index ca6729c..a2df266 100644 --- a/src/main/java/freemarker/template/Configuration.java +++ b/src/main/java/freemarker/template/Configuration.java @@ -115,7 +115,7 @@ import freemarker.template.utility.XmlEscape; * * // Where the application is initialized; in general you do this ONLY ONCE in the application life-cycle! * Configuration cfg = new Configuration(VERSION_X_Y_Z)); - * // Where X, Y, Z enables the not-100%-backward-compatible fixes introduced in + * // Where VERSION_X_Y_Z enables the not-100%-backward-compatible fixes introduced in * // FreeMarker version X.Y.Z and earlier (see {@link #Configuration(Version)}). * cfg.setSomeSetting(...); * cfg.setOtherSetting(...); @@ -1219,7 +1219,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf } /** - * Sets a {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side + * Sets the {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side * effect the template cache will be emptied. The default value is {@link TemplateLookupStrategy#DEFAULT_2_3_0}. * * @since 2.3.22 @@ -1530,7 +1530,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf /** * Sets the time in milliseconds that must elapse before checking whether there is a newer version of a template - * "file" exists than the cached one. Defaults to 5000 ms. + * "file" than the cached one. Defaults to 5000 ms. * * * When you get a template via {@link #getTemplate(String)} (or some of its overloads). FreeMarker will try to get @@ -1927,7 +1927,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf * Where you can't use the standard extensions, templates still can be associated to output formats with * patterns matching their name (their path) using {@link #setTemplateConfigurations(TemplateConfigurationFactory)}. * But if all templates will have the same output format, you may use {@link #setOutputFormat(OutputFormat)} after - * all, to set a value like {@link HTMLOutputFormat#INSTANCE}, {@link XMLOutputFormat#INSTANCE}, etc. Also note + * all, to a value like {@link HTMLOutputFormat#INSTANCE}, {@link XMLOutputFormat#INSTANCE}, etc. Also note * that templates can specify their own output format like {@code * <#ftl output_format="HTML">}, which overrides any configuration settings. * @@ -1992,7 +1992,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf * @param name *Either the name of the output format as it was registered with *{@link Configuration#setRegisteredCustomOutputFormats(Collection)}, or a combined output format name. - *A output combined format is created ad-hoc from the registered formats. For example, if you need RTF + *A combined output format is created ad-hoc from the registered formats. For example, if you need RTF *embedded into HTML, the name will be HTML{RTF}, where "HTML" and "RTF" refer to the *existing formats. This logic can be used recursively, so for example XML{HTML{RTF}} is *also valid. @@ -2337,7 +2337,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf } // To avoid integer overflows: if (tabSize > 256) { -throw new IllegalArgumentException("\"tabSize\" can be more than 256, but was " + tabSize); +throw new IllegalArgumentException("\"tabSize\" can't be more than 256, but was " + tabSize); } this.tabSize = tabSize;
[06/50] incubator-freemarker git commit: (Minor JavaDoc improvements)
(Minor JavaDoc improvements) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/9a609744 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9a609744 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9a609744 Branch: refs/heads/2.3 Commit: 9a609744e0494df0bd90c36f4bc9af926619e946 Parents: 62e2678 Author: ddekany Authored: Mon Apr 17 11:38:30 2017 +0200 Committer: ddekany Committed: Mon Apr 17 11:38:30 2017 +0200 -- src/main/java/freemarker/core/Configurable.java | 4 ++-- src/main/java/freemarker/template/Configuration.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9a609744/src/main/java/freemarker/core/Configurable.java -- diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java index 3aff2a6..7262e4f 100644 --- a/src/main/java/freemarker/core/Configurable.java +++ b/src/main/java/freemarker/core/Configurable.java @@ -1427,7 +1427,7 @@ public class Configurable { } /** - * Sets the URL escaping charset. If not set ({@code null}), the output encoding + * Sets the URL escaping (URL encoding, percentage encoding) charset. If {@code null}, the output encoding * ({@link #setOutputEncoding(String)}) will be used for URL escaping. * * Defaults to {@code null}. @@ -1720,7 +1720,7 @@ public class Configurable { * set to 2.3.24 fixes a rarely surfacing bug with that). * * - * It's recommended to set the {@code auto_impots_lazy} setting ({@link Configuration#setLazyAutoImports(Boolean)}) + * It's recommended to set the {@code lazy_auto_imports} setting ({@link Configuration#setLazyAutoImports(Boolean)}) * to {@code true} when using this, so that auto-imports that are unused in a template won't degrade performance by * unnecessary loading and initializing the imported library. * http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9a609744/src/main/java/freemarker/template/Configuration.java -- diff --git a/src/main/java/freemarker/template/Configuration.java b/src/main/java/freemarker/template/Configuration.java index ca5ee72..ca6729c 100644 --- a/src/main/java/freemarker/template/Configuration.java +++ b/src/main/java/freemarker/template/Configuration.java @@ -2983,7 +2983,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf if (!(item instanceof OutputFormat)) { throw new _MiscTemplateException(getEnvironment(), "Invalid value for setting ", new _DelayedJQuote(name), ": List items must be " -+ OutputFormat.class.getName() + " intances, in: ", value); ++ OutputFormat.class.getName() + " instances, in: ", value); } } setRegisteredCustomOutputFormats(list);
[09/50] incubator-freemarker git commit: Improved README build section.
Improved README build section. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/30aec8a1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/30aec8a1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/30aec8a1 Branch: refs/heads/2.3 Commit: 30aec8a17eaa131edefedf28c26e4f3f488a9214 Parents: fc308a9 Author: ddekany Authored: Mon Apr 17 14:37:10 2017 +0200 Committer: ddekany Committed: Mon Apr 17 14:37:10 2017 +0200 -- README.md | 40 +++- 1 file changed, 15 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/30aec8a1/README.md -- diff --git a/README.md b/README.md index e460531..eba34dd 100644 --- a/README.md +++ b/README.md @@ -94,43 +94,33 @@ In the binary release, open documentation/index.html, and you will find the link. -Local setup -=== +Building FreeMarker +=== -First of all, if you haven't yet, download the source release, or checkout -FreeMarker from the source code repository. +If you haven't yet, download the source release, or checkout FreeMarker from +the source code repository. See repository locations here: +http://freemarker.org/sourcecode.html -You need JDK 8(!), Apache Ant and Ivy to be installed. (As of this writing -it was tested with Ant 1.8.1 and Ivy 2.3.0.). - - -Ivy Installation - - -To install Ivy (but be sure it's not already installed). Issue -`ant download-ivy` which will copy it under `~/.ant/lib`. Alternatively, you -can copy `ivy-.jar` into your Ant home directory `lib` subfolder -manually. - - -Building - - -To build `freemarker.jar`, just issue `ant` in the project root directory, and -it should download all dependencies automatically and build freemarker.jar. +You need JDK 8, Apache Ant (tested with 1.8.1) and Ivy (tested with 2.3.0) to +be installed. To install Ivy (but be sure it's not already installed), issue +`ant download-ivy`; it will copy Ivy under `~/.ant/lib`. (Alternatively, you +can copy `ivy-.jar` into the Ant home `lib` subfolder manually.) It's recommended to copy `build.properties.sample` into `build.properties`, and edit its content to fit your system. (Although basic jar building should succeeds without the build.properties file too.) - -Managing dependencies -- +To build `freemarker.jar`, just issue `ant` in the project root directory, and +it should download all dependencies automatically and build `freemarker.jar`. If later you change the dependencies in `ivy.xml`, or otherwise want to re-download some of them, it will not happen automatically anymore, and you must issue `ant update-deps`. +To test your build, issue `ant test`. + +To generate documentation, issue `ant javadoc` and `ant manualOffline`. + Eclipse and other IDE setup ===
[10/50] incubator-freemarker git commit: Build: Upgraded to Ivy 2.4.0
Build: Upgraded to Ivy 2.4.0 Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/0c225466 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/0c225466 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/0c225466 Branch: refs/heads/2.3 Commit: 0c2254661f54be42d2b10fca8a74cd21a9ac5452 Parents: 30aec8a Author: ddekany Authored: Mon Apr 17 14:51:33 2017 +0200 Committer: ddekany Committed: Mon Apr 17 14:51:33 2017 +0200 -- README.md | 2 +- build.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c225466/README.md -- diff --git a/README.md b/README.md index eba34dd..d175433 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ If you haven't yet, download the source release, or checkout FreeMarker from the source code repository. See repository locations here: http://freemarker.org/sourcecode.html -You need JDK 8, Apache Ant (tested with 1.8.1) and Ivy (tested with 2.3.0) to +You need JDK 8, Apache Ant (tested with 1.8.1) and Ivy (tested with 2.4.0) to be installed. To install Ivy (but be sure it's not already installed), issue `ant download-ivy`; it will copy Ivy under `~/.ant/lib`. (Alternatively, you can copy `ivy-.jar` into the Ant home `lib` subfolder manually.) http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c225466/build.xml -- diff --git a/build.xml b/build.xml index 1db2c89..5b030bf 100644 --- a/build.xml +++ b/build.xml @@ -131,7 +131,7 @@ - +
[11/50] incubator-freemarker git commit: added javadoc task as part of the build process
added javadoc task as part of the build 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/6dcaf5cb Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/6dcaf5cb Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/6dcaf5cb Branch: refs/heads/2.3 Commit: 6dcaf5cb685a4ed9fb90bbac22c5fb20fffe8d03 Parents: 0c22546 Author: Pradeep Murugesan Authored: Sun Apr 16 09:47:49 2017 +0200 Committer: Pradeep Murugesan Committed: Mon Apr 17 15:29:10 2017 +0200 -- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6dcaf5cb/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index d663b22..c9a3521 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: java before_install: ant download-ivy -install: ant +install: + - ant + - ant javadoc jdk: - oraclejdk8 \ No newline at end of file
[39/50] incubator-freemarker git commit: Fixed some parser error message glitches.
Fixed some parser error message glitches. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/15afde13 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/15afde13 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/15afde13 Branch: refs/heads/2.3 Commit: 15afde13463306d0e96f09211e0ccdf92d9ec71e Parents: 16ff174 Author: ddekany Authored: Sat Aug 5 10:01:56 2017 +0200 Committer: ddekany Committed: Sat Aug 5 10:03:03 2017 +0200 -- src/main/javacc/FTL.jj | 6 +++--- src/test/java/freemarker/core/ParsingErrorMessagesTest.java | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index b011c41..175614c 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3227,7 +3227,7 @@ Macro Macro() : ) { if (inMacro || inFunction) { -throw new ParseException("Macros cannot be nested.", template, start); +throw new ParseException("Macro or function definitions can't be nested into each other.", template, start); } if (isFunction) inFunction = true; else inMacro = true; } @@ -3294,12 +3294,12 @@ Macro Macro() : ( end = { - if (isFunction) throw new ParseException("Expected function end tag here.", template, start); + if (isFunction) throw new ParseException("Expected function end tag here.", template, end); } | end = { - if (!isFunction) throw new ParseException("Expected macro end tag here.", template, start); + if (!isFunction) throw new ParseException("Expected macro end tag here.", template, end); } ) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/test/java/freemarker/core/ParsingErrorMessagesTest.java -- diff --git a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java index 53194a8..e471a31 100644 --- a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java +++ b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java @@ -61,7 +61,9 @@ public class ParsingErrorMessagesTest { @Test public void testUnclosedDirectives() { assertErrorContains("<#macro x>", "#macro", "unclosed"); +assertErrorContains("<#macro x>", "macro end tag"); assertErrorContains("<#function x>", "#macro", "unclosed"); +assertErrorContains("<#function x>", "function end tag"); assertErrorContains("<#assign x>", "#assign", "unclosed"); assertErrorContains("<#macro m><#local x>", "#local", "unclosed"); assertErrorContains("<#global x>", "#global", "unclosed");
[17/50] incubator-freemarker git commit: FREEMARKER-52: When setting the output_format with Properties, the XHTML abbreviation wasn't recognized. Like in a .properties file, output_format=XHTML didn't
FREEMARKER-52: When setting the output_format with Properties, the XHTML abbreviation wasn't recognized. Like in a .properties file, output_format=XHTML didn't work, only output_format=freemarker.core.XHTMLOutputFormat() did. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/017e9f58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/017e9f58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/017e9f58 Branch: refs/heads/2.3 Commit: 017e9f58065043066bf3a3f27c8bafb86b55dec2 Parents: 7b35587 Author: ddekany Authored: Fri May 26 10:07:25 2017 +0200 Committer: ddekany Committed: Fri May 26 10:07:52 2017 +0200 -- .../core/_ObjectBuilderSettingEvaluator.java| 1 + src/manual/en_US/book.xml | 31 +++- 2 files changed, 31 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/017e9f58/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java -- diff --git a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java index ed0849d..2f91b55 100644 --- a/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java +++ b/src/main/java/freemarker/core/_ObjectBuilderSettingEvaluator.java @@ -683,6 +683,7 @@ public class _ObjectBuilderSettingEvaluator { addWithSimpleName(SHORTHANDS, FirstMatchTemplateConfigurationFactory.class); addWithSimpleName(SHORTHANDS, HTMLOutputFormat.class); +addWithSimpleName(SHORTHANDS, XHTMLOutputFormat.class); addWithSimpleName(SHORTHANDS, XMLOutputFormat.class); addWithSimpleName(SHORTHANDS, RTFOutputFormat.class); addWithSimpleName(SHORTHANDS, PlainTextOutputFormat.class); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/017e9f58/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 3d68c65..a3656d1 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -30,7 +30,7 @@ Manual -Freemarker 2.3.26 +Freemarker 2.3.27 @@ -26840,6 +26840,35 @@ TemplateModel x = env.getVariable("x"); // get variable x Version history + +2.3.27 (incubating at Apache) + +Release date: FIXME + +This is a stable, final +release. The incubating suffix is required +by the Apache Software Foundation until the project becomes a fully +accepted (graduated) Apache project. + + + Changes on the Java side + + + + Bug fixed (https://issues.apache.org/jira/browse/FREEMARKER-52";>FREEMARKER-52): + When setting the output_format with + Properties, the XHTML + abbreviation wasn't recognized. Like in a + .properties file, + output_format=XHTML didn't work, only + output_format=freemarker.core.XHTMLOutputFormat() + did. + + + + + 2.3.26 (incubating at Apache)
[14/50] incubator-freemarker git commit: travis.yml file update
travis.yml file update Merge commit 'refs/pull/22/head' of https://github.com/apache/incubator-freemarker into 2.3-gae Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a4273fc8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a4273fc8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a4273fc8 Branch: refs/heads/2.3 Commit: a4273fc8e3d971f81d20eef76902d132106fe1f0 Parents: e64dc4d 4d6897e Author: ddekany Authored: Tue Apr 18 10:33:48 2017 +0200 Committer: ddekany Committed: Tue Apr 18 10:35:04 2017 +0200 -- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --
[43/50] incubator-freemarker git commit: (JavaDoc adjustment...)
(JavaDoc adjustment...) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/cb819b8a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/cb819b8a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/cb819b8a Branch: refs/heads/2.3 Commit: cb819b8aa2f0da9f6cf398b4fc33b59fc66a0c3e Parents: 889b8a9 Author: ddekany Authored: Sat Aug 5 11:57:50 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:57:50 2017 +0200 -- src/main/java/freemarker/core/ArithmeticEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cb819b8a/src/main/java/freemarker/core/ArithmeticEngine.java -- diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java index 5e485b8..9eedf64 100644 --- a/src/main/java/freemarker/core/ArithmeticEngine.java +++ b/src/main/java/freemarker/core/ArithmeticEngine.java @@ -38,7 +38,8 @@ public abstract class ArithmeticEngine { /** * Arithmetic engine that converts all numbers to {@link BigDecimal} and - * then operates on them. This is FreeMarker's default arithmetic engine. + * then operates on them, and also keeps the result as a {@link BigDecimal}. This is FreeMarker's default arithmetic + * engine. */ public static final BigDecimalEngine BIGDECIMAL_ENGINE = new BigDecimalEngine(); /**
[38/50] incubator-freemarker git commit: Simplified (and faster) capturing assignment implementation (backported from FM3 branch)
Simplified (and faster) capturing assignment implementation (backported from FM3 branch) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/16ff1746 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/16ff1746 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/16ff1746 Branch: refs/heads/2.3 Commit: 16ff17463762a18e9316814e53b1ad0e5eb09559 Parents: 77e877c Author: ddekany Authored: Thu Jul 27 18:54:01 2017 +0200 Committer: ddekany Committed: Thu Jul 27 19:14:57 2017 +0200 -- .../java/freemarker/core/BlockAssignment.java | 84 +--- src/main/java/freemarker/core/Environment.java | 15 .../core/CapturingAssignmentTest.java | 55 + 3 files changed, 89 insertions(+), 65 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/16ff1746/src/main/java/freemarker/core/BlockAssignment.java -- diff --git a/src/main/java/freemarker/core/BlockAssignment.java b/src/main/java/freemarker/core/BlockAssignment.java index 07ff070..8c9e403 100644 --- a/src/main/java/freemarker/core/BlockAssignment.java +++ b/src/main/java/freemarker/core/BlockAssignment.java @@ -21,14 +21,11 @@ package freemarker.core; import java.io.IOException; import java.io.StringWriter; -import java.io.Writer; -import java.util.Map; import freemarker.template.SimpleScalar; import freemarker.template.TemplateException; import freemarker.template.TemplateModel; import freemarker.template.TemplateModelException; -import freemarker.template.TemplateTransformModel; /** * Like [#local x]...[/#local]. @@ -51,21 +48,28 @@ final class BlockAssignment extends TemplateElement { @Override TemplateElement[] accept(Environment env) throws TemplateException, IOException { TemplateElement[] children = getChildBuffer(); + +TemplateModel value; if (children != null) { -env.visitAndTransform(children, new CaptureOutput(env), null); +StringWriter out = new StringWriter(); +env.visit(children, out); +value = capturedStringToModel(out.toString()); +} else { +value = capturedStringToModel(""); +} + +if (namespaceExp != null) { +((Environment.Namespace) namespaceExp.eval(env)).put(varName, value); +} else if (scope == Assignment.NAMESPACE) { +env.setVariable(varName, value); +} else if (scope == Assignment.GLOBAL) { +env.setGlobalVariable(varName, value); +} else if (scope == Assignment.LOCAL) { +env.setLocalVariable(varName, value); } else { -TemplateModel value = capturedStringToModel(""); -if (namespaceExp != null) { -Environment.Namespace ns = (Environment.Namespace) namespaceExp.eval(env); -ns.put(varName, value); -} else if (scope == Assignment.NAMESPACE) { -env.setVariable(varName, value); -} else if (scope == Assignment.GLOBAL) { -env.setGlobalVariable(varName, value); -} else if (scope == Assignment.LOCAL) { -env.setLocalVariable(varName, value); -} +throw new BugException("Unhandled scope"); } + return null; } @@ -73,56 +77,6 @@ final class BlockAssignment extends TemplateElement { return markupOutputFormat == null ? new SimpleScalar(s) : markupOutputFormat.fromMarkup(s); } -private class CaptureOutput implements TemplateTransformModel { -private final Environment env; -private final Environment.Namespace fnsModel; - -CaptureOutput(Environment env) throws TemplateException { -this.env = env; -TemplateModel nsModel = null; -if (namespaceExp != null) { -nsModel = namespaceExp.eval(env); -if (!(nsModel instanceof Environment.Namespace)) { -throw new NonNamespaceException(namespaceExp, nsModel, env); -} -} -fnsModel = (Environment.Namespace ) nsModel; -} - -public Writer getWriter(Writer out, Map args) { -return new StringWriter() { -@Override -public void close() throws IOException { -TemplateModel result; -try { -result = capturedStringToModel(toString()); -} catch (TemplateModelException e) { -// [Java 1.6] e to cause -throw new IOException("Failed to cre
[40/50] incubator-freemarker git commit: (JavaDoc adjustment)
(JavaDoc adjustment) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e3d1bb83 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e3d1bb83 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e3d1bb83 Branch: refs/heads/2.3 Commit: e3d1bb837df300d4b9230716cc391199a599e109 Parents: 15afde1 Author: ddekany Authored: Sat Aug 5 10:03:39 2017 +0200 Committer: ddekany Committed: Sat Aug 5 10:03:39 2017 +0200 -- src/main/java/freemarker/core/Environment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3d1bb83/src/main/java/freemarker/core/Environment.java -- diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java index c826381..565dcd4 100644 --- a/src/main/java/freemarker/core/Environment.java +++ b/src/main/java/freemarker/core/Environment.java @@ -242,8 +242,7 @@ public final class Environment extends Configurable { /** * Returns the {@link Template} that we are "lexically" inside at the moment. This template will change when * entering an {@code #include} or calling a macro or function in another template, or returning to yet another - * template with {@code #nested}. As such, it's useful in {@link TemplateDirectiveModel} to find out if from where - * the directive was called from. + * template with {@code #nested}. * * @see #getMainTemplate() * @see #getCurrentNamespace()
[19/50] incubator-freemarker git commit: Wrong bugfix description: output_format=XHTML isn't supposed to work and it doesn't either. It's output_format=XHTMLOutputFormat that works now.
Wrong bugfix description: output_format=XHTML isn't supposed to work and it doesn't either. It's output_format=XHTMLOutputFormat that works now. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3fc5f907 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3fc5f907 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3fc5f907 Branch: refs/heads/2.3 Commit: 3fc5f907056edf82e03fe47cf72fc176d2e110b6 Parents: f0a6f45 Author: ddekany Authored: Fri May 26 11:59:07 2017 +0200 Committer: ddekany Committed: Fri May 26 11:59:07 2017 +0200 -- src/manual/en_US/book.xml | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3fc5f907/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index a3656d1..3f003b3 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26858,12 +26858,13 @@ TemplateModel x = env.getVariable("x"); // get variable x Bug fixed (https://issues.apache.org/jira/browse/FREEMARKER-52";>FREEMARKER-52): When setting the output_format with - Properties, the XHTML - abbreviation wasn't recognized. Like in a - .properties file, - output_format=XHTML didn't work, only + Properties, the + XHTMLOutputFormat abbreviation wasn't + recognized (for example in a .properties + file, output_format=XHTMLOutputFormat didn't + work, only output_format=freemarker.core.XHTMLOutputFormat() - did. + did).
[03/50] incubator-freemarker git commit: Made README.md more plain-text-viewer friendly.
Made README.md more plain-text-viewer friendly. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/36fdc7ca Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/36fdc7ca Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/36fdc7ca Branch: refs/heads/2.3 Commit: 36fdc7ca2c7acf5b5f6ed34b2677924374c8efa5 Parents: fef04d8 Author: ddekany Authored: Thu Apr 13 14:53:30 2017 +0200 Committer: ddekany Committed: Thu Apr 13 14:53:30 2017 +0200 -- README.md | 89 -- 1 file changed, 43 insertions(+), 46 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/36fdc7ca/README.md -- diff --git a/README.md b/README.md index 7b1b039..e4ad314 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ ``` - Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -16,28 +15,29 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - ``` -Apache FreeMarker {version} [![Build Status](https://travis-ci.org/apache/incubator-freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/incubator-freemarker) +Apache FreeMarker {version} === - For the latest version or to report bugs visit: - http://freemarker.org/ +[![Build Status](https://travis-ci.org/apache/incubator-freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/incubator-freemarker) +For the latest version or to report bugs visit: +http://freemarker.org/ DISCLAIMER -== - Apache FreeMarker is an effort undergoing incubation at The Apache - Software Foundation (ASF). Incubation is required of all newly accepted - projects until a further review indicates that the infrastructure, - communications, and decision making process have stabilized in a manner - consistent with other successful ASF projects. While incubation status is - not necessarily a reflection of the completeness or stability of the - code, it does indicate that the project has yet to be fully endorsed by - the ASF. +-- + +Apache FreeMarker is an effort undergoing incubation at The Apache +Software Foundation (ASF). Incubation is required of all newly accepted +projects until a further review indicates that the infrastructure, +communications, and decision making process have stabilized in a manner +consistent with other successful ASF projects. While incubation status is +not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by +the ASF. What is Apache FreeMarker? @@ -87,6 +87,7 @@ If you are using Maven, just add this dependency: {version} ``` + Otherwise simply copy freemarker.jar to a location where your Java application's ClassLoader will find it. For example, if you are using FreeMarker in a web application, you probably want to put @@ -116,56 +117,52 @@ link. Local setup === -First of all, if you haven't yet, download the source release, or checkout FreeMarker from the source code repository. +First of all, if you haven't yet, download the source release, or checkout +FreeMarker from the source code repository. -You need -1. JDK 8(!), -2. Apache Ant and -3. Ivy +You need JDK 8(!), Apache Ant and Ivy to be installed. (As of this writing +it was tested with Ant 1.8.1 and Ivy 2.3.0.). -to be installed. (As of this writing it was tested with Ant 1.8.1 and Ivy 2.3.0.). Ivy Installation -To install Ivy (but be sure it's not already installed). -Issue -``` -ant download-ivy -``` -which will copy it under ~/.ant/lib. Alternatively, you can copy ivy-.jar into your Ant home directory "lib" subfolder manually. + + +To install Ivy (but be sure it's not already installed). Issue +`ant download-ivy` which will copy it under `~/.ant/lib`. Alternatively, you +can copy `ivy-.jar` into your Ant home directory `lib` subfolder +manually. Building + -To build freemarker.jar, just issue -``` -ant -``` -in the project root directory, and it should download all dependencies automatically and build freemarker.jar. +To build `freemarker.jar`, just issue `ant` in the project root directory, and +it should download all dependencies automatically and build freemarker.jar. + +It's recommended to copy `build.properties.sample` into `build.properties`, +and edit its content to fit your system. (Although basic ja
[12/50] incubator-freemarker git commit: changed the build script to point to ci task
changed the build script to point to ci task Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4d6897ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4d6897ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4d6897ec Branch: refs/heads/2.3 Commit: 4d6897ec4b64f10b3f0cc3d5730f3b8365d525fc Parents: 6dcaf5c Author: Pradeep Murugesan Authored: Mon Apr 17 15:30:27 2017 +0200 Committer: Pradeep Murugesan Committed: Mon Apr 17 15:30:27 2017 +0200 -- .travis.yml | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4d6897ec/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c9a3521..fb4fdc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: java -before_install: ant download-ivy -install: - - ant - - ant javadoc +install: ant download-ivy +script: ant ci jdk: - oraclejdk8 \ No newline at end of file
[44/50] incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
(Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/7d01bed4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7d01bed4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7d01bed4 Branch: refs/heads/2.3 Commit: 7d01bed48872fba44488720638b3fc40510012c6 Parents: cb819b8 Author: ddekany Authored: Sat Aug 5 12:11:33 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:11:33 2017 +0200 -- .travis.yml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d01bed4/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index fb4fdc1..c68923b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty language: java install: ant download-ivy script: ant ci
[08/50] incubator-freemarker git commit: Build: offline check not needed for download-ivy
Build: offline check not needed for download-ivy Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/fc308a95 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/fc308a95 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/fc308a95 Branch: refs/heads/2.3 Commit: fc308a95e6d145d1cffa92dec56341943a8dce04 Parents: 7295c65 Author: ddekany Authored: Mon Apr 17 13:13:49 2017 +0200 Committer: ddekany Committed: Mon Apr 17 13:13:49 2017 +0200 -- build.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/fc308a95/build.xml -- diff --git a/build.xml b/build.xml index 11772d1..1db2c89 100644 --- a/build.xml +++ b/build.xml @@ -136,8 +136,7 @@ - - + https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"; dest="${ivy.jar.file}" usetimestamp="true"/>
[31/50] incubator-freemarker git commit: Some internal AST oversight fixes, and a new internal parser setting, preventStrippings. These are needed for the FM2 to FM3 converter.
Some internal AST oversight fixes, and a new internal parser setting, preventStrippings. These are needed for the FM2 to FM3 converter. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/9b879885 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9b879885 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9b879885 Branch: refs/heads/2.3 Commit: 9b879885406d687595fb7dafd772087dd83541cb Parents: a36ea52 Author: ddekany Authored: Sat Jul 8 00:53:30 2017 +0200 Committer: ddekany Committed: Sat Jul 8 00:53:30 2017 +0200 -- .../java/freemarker/core/NumericalOutput.java | 4 ++-- src/main/java/freemarker/core/TextBlock.java| 4 ++-- .../java/freemarker/core/TrimInstruction.java | 8 +++ src/main/java/freemarker/core/_CoreAPI.java | 4 .../java/freemarker/template/Configuration.java | 22 +++- src/main/java/freemarker/template/Template.java | 9 +--- .../java/freemarker/template/_TemplateAPI.java | 4 src/main/javacc/FTL.jj | 15 ++--- .../freemarker/core/ast-strlitinterpolation.ast | 4 ++-- 9 files changed, 57 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/NumericalOutput.java -- diff --git a/src/main/java/freemarker/core/NumericalOutput.java b/src/main/java/freemarker/core/NumericalOutput.java index bd1ed11..08e8301 100644 --- a/src/main/java/freemarker/core/NumericalOutput.java +++ b/src/main/java/freemarker/core/NumericalOutput.java @@ -150,8 +150,8 @@ final class NumericalOutput extends Interpolation { Object getParameterValue(int idx) { switch (idx) { case 0: return expression; -case 1: return Integer.valueOf(minFracDigits); -case 2: return Integer.valueOf(maxFracDigits); +case 1: return hasFormat ? Integer.valueOf(minFracDigits) : null; +case 2: return hasFormat ? Integer.valueOf(maxFracDigits) : null; default: throw new IndexOutOfBoundsException(); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/TextBlock.java -- diff --git a/src/main/java/freemarker/core/TextBlock.java b/src/main/java/freemarker/core/TextBlock.java index fb343fa..8be305b 100644 --- a/src/main/java/freemarker/core/TextBlock.java +++ b/src/main/java/freemarker/core/TextBlock.java @@ -143,8 +143,8 @@ public final class TextBlock extends TemplateElement { private boolean deliberateLeftTrim() { boolean result = false; for (TemplateElement elem = this.nextTerminalNode(); - elem != null && elem.beginLine == this.endLine; - elem = elem.nextTerminalNode()) { +elem != null && elem.beginLine == this.endLine; +elem = elem.nextTerminalNode()) { if (elem instanceof TrimInstruction) { TrimInstruction ti = (TrimInstruction) elem; if (!ti.left && !ti.right) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/TrimInstruction.java -- diff --git a/src/main/java/freemarker/core/TrimInstruction.java b/src/main/java/freemarker/core/TrimInstruction.java index 1279b99..a563a8a 100644 --- a/src/main/java/freemarker/core/TrimInstruction.java +++ b/src/main/java/freemarker/core/TrimInstruction.java @@ -25,10 +25,10 @@ package freemarker.core; */ final class TrimInstruction extends TemplateElement { -private static final int TYPE_T = 0; -private static final int TYPE_LT = 1; -private static final int TYPE_RT = 2; -private static final int TYPE_NT = 3; +static final int TYPE_T = 0; +static final int TYPE_LT = 1; +static final int TYPE_RT = 2; +static final int TYPE_NT = 3; final boolean left, right; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9b879885/src/main/java/freemarker/core/_CoreAPI.java -- diff --git a/src/main/java/freemarker/core/_CoreAPI.java b/src/main/java/freemarker/core/_CoreAPI.java index 66442da..1f10f81 100644 --- a/src/main/java/freemarker/core/_CoreAPI.java +++ b/src/main/java/freemarker/core/_CoreAPI.java @@ -213,5 +213,9 @@ public class _CoreAPI { public static TemplateElement getChildElement(TemplateElement te, int index) { return te.getChild(index); } + +public static void setPreventStrippings(FMParser
[34/50] incubator-freemarker git commit: Additions to the recent #switch improvements.
Additions to the recent #switch improvements. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c3672d96 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c3672d96 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c3672d96 Branch: refs/heads/2.3 Commit: c3672d96544e1cb96454410cd76a737ec4cf80e5 Parents: 6f0283d Author: ddekany Authored: Sun Jul 9 17:12:52 2017 +0200 Committer: ddekany Committed: Sun Jul 9 17:12:52 2017 +0200 -- src/main/java/freemarker/core/SwitchBlock.java| 2 +- .../resources/freemarker/test/templatesuite/expected/switch.txt | 2 ++ .../resources/freemarker/test/templatesuite/templates/switch.ftl | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/main/java/freemarker/core/SwitchBlock.java -- diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java index 15a5eea..3f8a320 100644 --- a/src/main/java/freemarker/core/SwitchBlock.java +++ b/src/main/java/freemarker/core/SwitchBlock.java @@ -142,7 +142,7 @@ final class SwitchBlock extends TemplateElement { // The first #case might have shifted in the child array, so we have to find it again: int ln = getChildCount(); int i = 0; -while (i < ln && !(getChildAt(i) instanceof Case)) { +while (i < ln && !(getChild(i) instanceof Case)) { i++; } firstCaseIndex = i; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/expected/switch.txt -- diff --git a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt index 5d42785..d0dbd27 100644 --- a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt +++ b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt @@ -63,6 +63,8 @@ [] +[] + "" "1234" "234" http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl -- diff --git a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl index 4404307..e9bd377 100644 --- a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl +++ b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl @@ -97,6 +97,7 @@ <#case 3> 3 <#switch x*2> +<#-- Comment is allowed here since 2.3.27 --> <#case 1> i1 <#break> @@ -122,6 +123,8 @@ <#case 1>sadas ] +[<#switch 213>] + <#-- Fall-through --> <#list [ 0, 1, 2, 3, 4 ] as x> "<#switch x><#case 1>1<#case 2>2<#case 3>3<#case 4>4"
[01/50] incubator-freemarker git commit: converted the readme from txt to md and added the build status from travis
Repository: incubator-freemarker Updated Branches: refs/heads/2.3 bfb836b25 -> a5fb3511f converted the readme from txt to md and added the build status from travis Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f871237b Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f871237b Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f871237b Branch: refs/heads/2.3 Commit: f871237b3101c9ce531b6b675a77d39793179644 Parents: 93dea88 Author: Pradeep Murugesan Authored: Thu Apr 13 12:30:54 2017 +0200 Committer: Pradeep Murugesan Committed: Thu Apr 13 12:30:54 2017 +0200 -- README| 237 README.md | 256 + build.xml | 10 +-- 3 files changed, 260 insertions(+), 243 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f871237b/README -- diff --git a/README b/README deleted file mode 100644 index c5cfc1e..000 --- a/README +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -=== - - Apache FreeMarker {version} - - For the latest version or to report bugs visit: - - http://freemarker.org/ - -=== - - DISCLAIMER - - Apache FreeMarker is an effort undergoing incubation at The Apache - Software Foundation (ASF). Incubation is required of all newly accepted - projects until a further review indicates that the infrastructure, - communications, and decision making process have stabilized in a manner - consistent with other successful ASF projects. While incubation status is - not necessarily a reflection of the completeness or stability of the - code, it does indicate that the project has yet to be fully endorsed by - the ASF. - - -What is Apache FreeMarker? --- - -FreeMarker is a "template engine"; a generic tool to generate text -output (anything from HTML to auto generated source code) based on -templates. It's a Java package, a class library for Java programmers. -It's not an application for end-users in itself, but something that -programmers can embed into their products. FreeMarker is designed to -be practical for the generation of HTML Web pages, particularly by -servlet-based applications following the MVC (Model View Controller) -pattern. - - -Licensing -- - -FreeMarker is licensed under the Apache License, Version 2.0. - -See the LICENSE file for more details! - - -Documentation -- - -Online: http://freemarker.org/docs/ - -Offline: The full documentation is available in the binary distribution -in the documentation/index.html directory. - - -Installing --- - -If you are using Maven, just add this dependency: - - - -org.freemarker -freemarker -{version} - - -Otherwise simply copy freemarker.jar to a location where your Java -application's ClassLoader will find it. For example, if you are using -FreeMarker in a web application, you probably want to put -freemarker.jar into the WEB-INF/lib directory of your web application. - -FreeMarker has no required dependencies. It has several optional -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. - -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.) - - -Change log --- - -Online (for stable releases only): -http://freemarker.org/docs/app_versions.html - -Offline: -In the binary release, open documentation/index.html, and you will find the -link. - - -Building - - -First of all, if you haven't yet, download the source
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae c688e15c7 -> 67691b4c6 (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/67691b4c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/67691b4c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/67691b4c Branch: refs/heads/2.3-gae Commit: 67691b4c62d51998f5eb86f77bdaa24a98c10725 Parents: c688e15 Author: ddekany Authored: Sat Aug 5 13:11:23 2017 +0200 Committer: ddekany Committed: Sat Aug 5 13:11:23 2017 +0200 -- .travis.yml | 6 +- build.xml | 14 +- 2 files changed, 6 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 5e1f7ca..3a560ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: java -install: ant download-ivy download-ant-junit +before_install: +- sudo apt-get -qq update +# ant-optional is needed for ant junit +- sudo apt-get install ant-optional +install: ant download-ivy script: ant ci jdk: - oraclejdk8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/67691b4c/build.xml -- diff --git a/build.xml b/build.xml index 4f45785..88deeea 100644 --- a/build.xml +++ b/build.xml @@ -140,18 +140,6 @@ https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"; dest="${ivy.jar.file}" usetimestamp="true"/> - - - - - - - - - -https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"; - dest="${ant-junit.jar.file}" usetimestamp="true"/> - @@ -460,7 +448,7 @@ - +
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae c2fcbc8dd -> c688e15c7 (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c688e15c Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c688e15c Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c688e15c Branch: refs/heads/2.3-gae Commit: c688e15c7049d61523a709c43e0a6bd7b8df59dd Parents: c2fcbc8 Author: ddekany Authored: Sat Aug 5 12:41:55 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:41:55 2017 +0200 -- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c688e15c/build.xml -- diff --git a/build.xml b/build.xml index 7f5b57a..4f45785 100644 --- a/build.xml +++ b/build.xml @@ -142,7 +142,8 @@ - + +
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 13ddf6462 -> c2fcbc8dd (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c2fcbc8d Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c2fcbc8d Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c2fcbc8d Branch: refs/heads/2.3-gae Commit: c2fcbc8dd55dfc95538a23b8a34b9df9fb7c3ea2 Parents: 13ddf64 Author: ddekany Authored: Sat Aug 5 12:38:00 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:38:00 2017 +0200 -- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c2fcbc8d/build.xml -- diff --git a/build.xml b/build.xml index 1e7e340..7f5b57a 100644 --- a/build.xml +++ b/build.xml @@ -141,7 +141,8 @@ dest="${ivy.jar.file}" usetimestamp="true"/> - + +
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae b9978edde -> 13ddf6462 (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/13ddf646 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/13ddf646 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/13ddf646 Branch: refs/heads/2.3-gae Commit: 13ddf6462ad9f9c6d162202ba5e3af29343e4f08 Parents: b9978ed Author: ddekany Authored: Sat Aug 5 12:24:10 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:24:10 2017 +0200 -- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/13ddf646/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c0493be..5e1f7ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -install: ant download-ivy download-junit +install: ant download-ivy download-ant-junit script: ant ci jdk: - oraclejdk8 \ No newline at end of file
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 7d01bed48 -> b9978edde (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/b9978edd Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/b9978edd Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/b9978edd Branch: refs/heads/2.3-gae Commit: b9978edde7822046f81c0976a10028940d9bd990 Parents: 7d01bed Author: ddekany Authored: Sat Aug 5 12:22:49 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:22:49 2017 +0200 -- .travis.yml | 3 +-- build.xml | 11 ++- 2 files changed, 11 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c68923b..c0493be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ -dist: trusty language: java -install: ant download-ivy +install: ant download-ivy download-junit script: ant ci jdk: - oraclejdk8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b9978edd/build.xml -- diff --git a/build.xml b/build.xml index 32e4168..1e7e340 100644 --- a/build.xml +++ b/build.xml @@ -135,12 +135,21 @@ - https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"; dest="${ivy.jar.file}" usetimestamp="true"/> + + + + + + + +https://repo1.maven.org/maven2/org/apache/ant/ant-junit/${ant-junit.install.version}/ant-junit-${ant-junit.install.version}.jar"; + dest="${ant-junit.jar.file}" usetimestamp="true"/> +
incubator-freemarker git commit: (Attempt to fix Travis problem with JUnit)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae cb819b8aa -> 7d01bed48 (Attempt to fix Travis problem with JUnit) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/7d01bed4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7d01bed4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7d01bed4 Branch: refs/heads/2.3-gae Commit: 7d01bed48872fba44488720638b3fc40510012c6 Parents: cb819b8 Author: ddekany Authored: Sat Aug 5 12:11:33 2017 +0200 Committer: ddekany Committed: Sat Aug 5 12:11:33 2017 +0200 -- .travis.yml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d01bed4/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index fb4fdc1..c68923b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty language: java install: ant download-ivy script: ant ci
incubator-freemarker git commit: (JavaDoc adjustment...)
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 889b8a965 -> cb819b8aa (JavaDoc adjustment...) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/cb819b8a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/cb819b8a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/cb819b8a Branch: refs/heads/2.3-gae Commit: cb819b8aa2f0da9f6cf398b4fc33b59fc66a0c3e Parents: 889b8a9 Author: ddekany Authored: Sat Aug 5 11:57:50 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:57:50 2017 +0200 -- src/main/java/freemarker/core/ArithmeticEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cb819b8a/src/main/java/freemarker/core/ArithmeticEngine.java -- diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java index 5e485b8..9eedf64 100644 --- a/src/main/java/freemarker/core/ArithmeticEngine.java +++ b/src/main/java/freemarker/core/ArithmeticEngine.java @@ -38,7 +38,8 @@ public abstract class ArithmeticEngine { /** * Arithmetic engine that converts all numbers to {@link BigDecimal} and - * then operates on them. This is FreeMarker's default arithmetic engine. + * then operates on them, and also keeps the result as a {@link BigDecimal}. This is FreeMarker's default arithmetic + * engine. */ public static final BigDecimalEngine BIGDECIMAL_ENGINE = new BigDecimalEngine(); /**
incubator-freemarker git commit: GeneralPurposeNothing also implements TemplateHashModelEx2
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 2aebfe533 -> 889b8a965 GeneralPurposeNothing also implements TemplateHashModelEx2 Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/889b8a96 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/889b8a96 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/889b8a96 Branch: refs/heads/2.3-gae Commit: 889b8a965a19588037a90aadf5c58d51386520ec Parents: 2aebfe5 Author: ddekany Authored: Sat Aug 5 11:16:38 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:16:38 2017 +0200 -- .../freemarker/template/GeneralPurposeNothing.java | 15 +-- src/manual/en_US/book.xml| 8 +--- 2 files changed, 14 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/src/main/java/freemarker/template/GeneralPurposeNothing.java -- diff --git a/src/main/java/freemarker/template/GeneralPurposeNothing.java b/src/main/java/freemarker/template/GeneralPurposeNothing.java index 7ba8602..8023bd8 100644 --- a/src/main/java/freemarker/template/GeneralPurposeNothing.java +++ b/src/main/java/freemarker/template/GeneralPurposeNothing.java @@ -19,9 +19,10 @@ package freemarker.template; -import java.util.ArrayList; import java.util.List; +import freemarker.template.utility.Constants; + /** * Singleton object representing nothing, used by ?if_exists built-in. * It is meant to be interpreted in the most sensible way possible in various contexts. @@ -29,11 +30,9 @@ import java.util.List; */ final class GeneralPurposeNothing -implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx, TemplateMethodModelEx { +implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, TemplateHashModelEx2, TemplateMethodModelEx { private static final TemplateModel instance = new GeneralPurposeNothing(); - -private static final TemplateCollectionModel EMPTY_COLLECTION = new SimpleCollection(new ArrayList(0)); private GeneralPurposeNothing() { } @@ -71,10 +70,14 @@ implements TemplateBooleanModel, TemplateScalarModel, TemplateSequenceModel, Tem } public TemplateCollectionModel keys() { -return EMPTY_COLLECTION; +return Constants.EMPTY_COLLECTION; } public TemplateCollectionModel values() { -return EMPTY_COLLECTION; +return Constants.EMPTY_COLLECTION; +} + +public KeyValuePairIterator keyValuePairIterator() throws TemplateModelException { +return Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR; } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/889b8a96/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 1288f8a..6d6d6f9 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -26982,10 +26982,12 @@ TemplateModel x = env.getVariable("x"); // get variable x - Constants.EMPTY_HASH now implements + Constants.EMPTY_HASH and + GeneralPurposeNothing (the value of + missingVar!) now implements TemplateHashModelEx2, so it can be listed - with <#list ... as k, v>. Earlier it - was only a TemplateHashModelEx. + with <#list ... as k, v>. Earlier they + were only a TemplateHashModelEx-s.
[2/3] incubator-freemarker git commit: (JavaDoc adjustment)
(JavaDoc adjustment) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/e3d1bb83 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/e3d1bb83 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/e3d1bb83 Branch: refs/heads/2.3-gae Commit: e3d1bb837df300d4b9230716cc391199a599e109 Parents: 15afde1 Author: ddekany Authored: Sat Aug 5 10:03:39 2017 +0200 Committer: ddekany Committed: Sat Aug 5 10:03:39 2017 +0200 -- src/main/java/freemarker/core/Environment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/e3d1bb83/src/main/java/freemarker/core/Environment.java -- diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java index c826381..565dcd4 100644 --- a/src/main/java/freemarker/core/Environment.java +++ b/src/main/java/freemarker/core/Environment.java @@ -242,8 +242,7 @@ public final class Environment extends Configurable { /** * Returns the {@link Template} that we are "lexically" inside at the moment. This template will change when * entering an {@code #include} or calling a macro or function in another template, or returning to yet another - * template with {@code #nested}. As such, it's useful in {@link TemplateDirectiveModel} to find out if from where - * the directive was called from. + * template with {@code #nested}. * * @see #getMainTemplate() * @see #getCurrentNamespace()
[1/3] incubator-freemarker git commit: Fixed some parser error message glitches.
Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 16ff17463 -> 2aebfe533 Fixed some parser error message glitches. Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/15afde13 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/15afde13 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/15afde13 Branch: refs/heads/2.3-gae Commit: 15afde13463306d0e96f09211e0ccdf92d9ec71e Parents: 16ff174 Author: ddekany Authored: Sat Aug 5 10:01:56 2017 +0200 Committer: ddekany Committed: Sat Aug 5 10:03:03 2017 +0200 -- src/main/javacc/FTL.jj | 6 +++--- src/test/java/freemarker/core/ParsingErrorMessagesTest.java | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/main/javacc/FTL.jj -- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index b011c41..175614c 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3227,7 +3227,7 @@ Macro Macro() : ) { if (inMacro || inFunction) { -throw new ParseException("Macros cannot be nested.", template, start); +throw new ParseException("Macro or function definitions can't be nested into each other.", template, start); } if (isFunction) inFunction = true; else inMacro = true; } @@ -3294,12 +3294,12 @@ Macro Macro() : ( end = { - if (isFunction) throw new ParseException("Expected function end tag here.", template, start); + if (isFunction) throw new ParseException("Expected function end tag here.", template, end); } | end = { - if (!isFunction) throw new ParseException("Expected macro end tag here.", template, start); + if (!isFunction) throw new ParseException("Expected macro end tag here.", template, end); } ) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/test/java/freemarker/core/ParsingErrorMessagesTest.java -- diff --git a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java index 53194a8..e471a31 100644 --- a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java +++ b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java @@ -61,7 +61,9 @@ public class ParsingErrorMessagesTest { @Test public void testUnclosedDirectives() { assertErrorContains("<#macro x>", "#macro", "unclosed"); +assertErrorContains("<#macro x>", "macro end tag"); assertErrorContains("<#function x>", "#macro", "unclosed"); +assertErrorContains("<#function x>", "function end tag"); assertErrorContains("<#assign x>", "#assign", "unclosed"); assertErrorContains("<#macro m><#local x>", "#local", "unclosed"); assertErrorContains("<#global x>", "#global", "unclosed");
[3/3] incubator-freemarker git commit: Documented the precision of arithmetical operations
Documented the precision of arithmetical operations Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/2aebfe53 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/2aebfe53 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/2aebfe53 Branch: refs/heads/2.3-gae Commit: 2aebfe53331a6306481d44cee94eb45c6f42797b Parents: e3d1bb8 Author: ddekany Authored: Sat Aug 5 11:05:32 2017 +0200 Committer: ddekany Committed: Sat Aug 5 11:05:32 2017 +0200 -- .../java/freemarker/core/ArithmeticEngine.java| 5 +++-- src/manual/en_US/book.xml | 18 -- 2 files changed, 19 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/main/java/freemarker/core/ArithmeticEngine.java -- diff --git a/src/main/java/freemarker/core/ArithmeticEngine.java b/src/main/java/freemarker/core/ArithmeticEngine.java index c07dc92..5e485b8 100644 --- a/src/main/java/freemarker/core/ArithmeticEngine.java +++ b/src/main/java/freemarker/core/ArithmeticEngine.java @@ -30,9 +30,10 @@ import freemarker.template.utility.OptimizerUtil; import freemarker.template.utility.StringUtil; /** - * Class to perform arithmetic operations. + * Used for implementing the arithmetic operations and number comparisons in the template language. The concrete + * implementation is plugged into the configuration with the {@code arithmetical_engine} setting. + * (See {@link Configurable#setArithmeticEngine(ArithmeticEngine)}.) */ - public abstract class ArithmeticEngine { /** http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2aebfe53/src/manual/en_US/book.xml -- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index e072d1a..1288f8a 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -3304,8 +3304,6 @@ Slicing with right-unlimited ranges: - Information about the precision? - Example: ${100 - x * x} @@ -3385,6 +3383,22 @@ ${12 % 6.9} <#-- Prints 0 --> ${-12 % 5} <#-- Prints -2 --> ${12 % -5} <#-- Prints 2 --> + + About the precision of the operations: + By default FreeMarker uses BigDecimal-s for all + arithmetical calculations, to avoid rounding and overflow/underflow + artifacts, and also keeps the result as + BigDecimal-s. So + (addition), + - (subtraction) and * + (multiplication) are lossless. Again by default, + / (division) results are calculated to 12 + decimals with half-up rounding (unless some operands have even more + decimals, in which case it's calculated with that much decimals). + All this behavior depends on the + arithmetic_engine configuration setting + (Configurable.setArithmericEngine(ArithmericEngine)) + though, and some application might use a different value than the + default, although that's highly uncommon.