FMPP 使用旧的 FTL 语法

FMPP use old FTL syntax

应该可以将 freemarker 配置为使用旧的 #-less 语法。

However, to give users time to prepare for this change, in FreeMarker 2.1 and 2.2 the usage of # is optional, unless the programmer enables strict syntax mode in the FreeMarker configuration by calling setStrictSyntaxMode(true) on Configuration. In fact, we strongly recommend this to programmers. Starting from some later release this setting will be initially set to true. Also, you can specify if you want to use strict syntax or old syntax in the template files with the ftl directive.

如何配置 fmpp 预处理器以将这种旧语法与 Ant 集成一起使用?是否有设置或如何调用 setStrictSyntaxMode(false)?

非常感谢您的帮助!

看来你不能...它没有通过 FMPP 的设置公开 API。值得庆幸的是,新语法更实用,因为它捕获了更多拼写错误,而且 Eclipse 插件支持它。因此,如果您有一些旧模板,当然最好花 15 分钟和 search-and-replace 使用 # 版本的 FTL 标签。

我可以通过使用引擎提供的 "setOldTemplateSyntax" 方法添加 "oldSyntax" 设置来解决这个问题。

https://github.com/freemarker/fmpp/issues/20