freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (FREEMARKER-63) FM3 Unification and improvement of directive-like constructs
Date Thu, 03 Aug 2017 21:21:00 GMT


ASF GitHub Bot commented on FREEMARKER-63:

GitHub user ddekany opened a pull request:

    FREEMARKER-63: Unification and improvement of directive-like constructs

    Redesigned `TemplateDirectiveModel` now support both by position and by name parameter
passing, even mixed in the same call. `#macros`-s also create `TemplateDirectiveModel`-s,
and supports defining if a parameter is positional or named. Removed deprecated `TemplateTransformModel`.
    Added `TemplateFunctionModel`, which meant to replace `TemplateMethodModel` and `TemplateMethodModelEx`
in another Jira issue, but for now it's only what `#function` creates. This also supports
both positional and named parameters (though the call syntax in the expression language isn't
updated in this issue, so it still only can pass positional parameters). `#function` was upgraded
to support the same new features as `#macro`.

You can merge this pull request into a Git repository by running:

    $ git pull FREEMARKER-63

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #30
commit c28a78bd8dad4bfd3a37a90a26fbb15639d33604
Author: ddekany <>
Date:   2017-07-24T18:26:29Z

    FREEMARKER-63:  Very early state. Until it's fully functional, the new interface is called
TemplateDirectiveModel2, and is invoked with <~...> instead of <@...>. Later it
will replace TemplateDirectiveModel and the syntax will be <@...>.

commit 46c750109ffe9e4c7e52e4c3df94b78c3445f780
Author: ddekany <>
Date:   2017-07-26T21:48:11Z

    FREEMARKER-63:  Very early state. Added support for nested content and loop variables.
Added StringToIndexMap, which is used for mapping names to their index in the value arrays
(a concept that we use at a few places now).

commit fbbfadb443efac2009439564f1d3c664ff8a51b0
Author: ddekany <>
Date:   2017-07-27T16:20:37Z

    FREEMARKER-63:  Very early state. Some cleanups. Temporarily added support for calling
legacy ASTDirMacro-s with the also temporary <~...>syntax.

commit 146c42572c440dd4ef911d437239d3e54a7fe95b
Author: ddekany <>
Date:   2017-07-27T16:43:05Z

    FREEMARKER-63:  Very early state. Simplified capturing assignment implementation

commit 1e27397dd9570ac2f48be6100afd2bba7b42b8b8
Author: ddekany <>
Date:   2017-07-27T18:45:01Z

    Removed the legacy predefined shared variables: "html_escape", "normalize_newlines", "xml_escape",
"capture_output", "compress". It had to be done now as TemplateTransformModel will be removed
as part of FREEMARKER-63.

commit a6399a793f54f531a11a7a9d13b9eb47d648563a
Author: ddekany <>
Date:   2017-07-27T19:24:14Z

    FREEMARKER-63:  Bit of API/javadoc cleanup

commit 52a5f9eb8881a2c976a2b84ff683d8c11238efca
Author: ddekany <>
Date:   2017-07-30T00:04:56Z

    FREEMARKER-63: Removed TemplateTransformModel and the old TemplateDirectiveModel, renamed
TemplateDirectiveModel2 to TemplateDirectiveModel. Removed the temporary `<~...>` syntax;
now `<@...>` is used to call the new TemplateDirectiveModel. Lot of API refinement,
like introduced ArgumentArrayLayout class. Several test cases won't yet pass... work in progress.

commit 126c506984ea1e006b719ebb3ae92a4207c4c9f2
Author: ddekany <>
Date:   2017-07-30T13:57:46Z

    FREEMARKER-63: Fixed failing test. (Now the test suite passes.)

commit 589d9b80e218a39d2ac128b1108952992868cc40
Author: ddekany <>
Date:   2017-07-30T18:38:01Z

    FREEMARKER-63: Change 1: Replaced the "loop variable" term with the more generic "nested
content parameter" term. (In FM2, loop variables were introduced earlier than nested content
parameter, so the two term coulnd't be unified. So it's just one less term in FM3.)
    Change 2: CallPlace.executeNestedContent now requires the nested content paramter value
array to have exactly the same length as the number of parameters declared by the caller.

commit 5bd19adeb8dd24cde34987c4724c7a5d5d227f52
Author: ddekany <>
Date:   2017-07-30T21:07:29Z

    FREEMARKER-63: Added isNestedContentSupported() to templateDirectiveModel

commit da4c33292d5d73cdfb53613ca64bd0834fcfb5fd
Author: ddekany <>
Date:   2017-07-30T21:20:34Z

    FREEMARKER-63: Removed NestedContentNotSupportedException, as TemplateDirectiveModel.isNestedContentSupported()
now takes care of that problem.

commit 3cacd9ed04a231af67e3964525fd592b97da1665
Author: ddekany <>
Date:   2017-08-03T21:11:57Z

    FREEMARKER-63: Lot of refinement in the API-s and implementation. #macro now creates a
`TemplateDirectiveModel`, and #function now creates `TemplateFunctionModel` (though the function/method
call syntax doesn't yet allow named parameters). Test suite passes.


> FM3 Unification and improvement of directive-like constructs
> ------------------------------------------------------------
>                 Key: FREEMARKER-63
>                 URL:
>             Project: Apache Freemarker
>          Issue Type: New Feature
>          Components: engine
>    Affects Versions: 3.0.0
>            Reporter: Daniel Dekany
>            Assignee: Daniel Dekany
> In FreeMarker 3 all kind of directive-like user defined objects (macros, {{TemplateDirectiveModel}}-s,
{{TempalteTransfromModel}}-s, etc) has to be united under a single {{TemplateModel}} subinterface,
which support all the features supported by the replaced FM2 concepts (e.g. nested content
execution, loop variables, passing parameters by position and by name, varargs in both cases,
call place bound caching, etc.). Obviously, the template language has to support calling this
new interface, and then the old ones has to be removed.
> Furthermore, as a new feature in FM3, passing parameter both by position and by name
in the same invocation (as in {{<@image "foo.jpg" alt="Foo" />}}) need to be supported.
> (Similarly, {{#function}} and {{TempalteMethodModel}} will have to be generalized and
united, but that will be in a separate issue.)

This message was sent by Atlassian JIRA

View raw message