Repository: incubator-freemarker Updated Branches: refs/heads/3 507b89bf5 -> 1f086e3f2
You can't close #attempt/#recover with `</#recover>` anymore, only with `<#attempt>`. This was the standard form in FM2 as well, and is consistent with how #if/#else works. (The template converter tool does this conversion.) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/af17c347 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/af17c347 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/af17c347 Branch: refs/heads/3 Commit: af17c347fa817d5ce8b826e245e64b740e2d82d0 Parents: 507b89b Author: ddekany <ddek...@apache.org> Authored: Sun Jul 2 19:09:30 2017 +0200 Committer: ddekany <ddek...@apache.org> Committed: Sun Jul 2 19:09:30 2017 +0200 ---------------------------------------------------------------------- FM3-CHANGE-LOG.txt | 5 ++++- .../freemarker/core/templatesuite/templates/recover.ftl | 8 ++++---- freemarker-core/src/main/javacc/FTL.jj | 6 +----- 3 files changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af17c347/FM3-CHANGE-LOG.txt ---------------------------------------------------------------------- diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt index ba175ee..6a80de0 100644 --- a/FM3-CHANGE-LOG.txt +++ b/FM3-CHANGE-LOG.txt @@ -289,4 +289,7 @@ the FreeMarer 3 changelog here: template converter tool translates these to `${}` interpolations. For example `#{x}` is simply translated to `${b}`, while `#{x; m1M3}` is translated to `${x?string('0.0##')}`). - #attempt now logs errors into the org.apache.freemarker.core.Runtime.Attempt log chategory (by - default). It doesn't create an additional debug level log entry anymore. \ No newline at end of file + default). It doesn't create an additional debug level log entry anymore. +- You can't close #attempt/#recover with `</#recover>` anymore, only with `<#attempt>`. This was the + standard form in FM2 as well, and is consistent with how #if/#else works. (The template converter + tool does this conversion.) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af17c347/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/recover.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/recover.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/recover.ftl index f7dc437..afcc423 100644 --- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/recover.ftl +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/recover.ftl @@ -21,7 +21,7 @@ ${sequence[0]} <#recover> We should never get here. -</#recover> +</#attempt> <#attempt> Let's try to output an undefined variable: ${undefinedVariable} <#recover> @@ -32,14 +32,14 @@ <#recover> Oops...<@assert test=.error?contains('sequence[1]') /> Remember, freeMarker sequences are zero-based! ${sequence[0]} - </#recover> + </#attempt> Now we check the current error message.<@assert test=.error?contains('undefinedVariable') /> -</#recover> +</#attempt> <#attempt> <#include "nonexistent_template"> <#recover> The template is not currently available -</#recover> +</#attempt> <#attempt> <#include "undefined.ftl"> <#recover> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af17c347/freemarker-core/src/main/javacc/FTL.jj ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/javacc/FTL.jj b/freemarker-core/src/main/javacc/FTL.jj index 68c837e..fd07a66 100644 --- a/freemarker-core/src/main/javacc/FTL.jj +++ b/freemarker-core/src/main/javacc/FTL.jj @@ -2261,11 +2261,7 @@ ASTDirAttemptRecoverContainer Attempt() : start = <ATTEMPT> children = MixedContentElements() recoveryBlock = Recover() - ( - end = <END_RECOVER> - | - end = <END_ATTEMPT> - ) + end = <END_ATTEMPT> { ASTDirAttemptRecoverContainer result = new ASTDirAttemptRecoverContainer(children, recoveryBlock); result.setLocation(template, start, end);