[
https://issues.apache.org/jira/browse/FREEMARKER-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15003055#comment-15003055
]
Daniel Dekany edited comment on FREEMARKER-9 at 11/12/15 10:16 PM:
-------------------------------------------------------------------
It's because macro call tags always have to be explicitly closed (similarly to
XML tags), so {{<@testMacro "A">}} is a start-tag, and hence the enclosed
{{#else}} has no corresponding {{#if}}. Try {{<@testMacro "A" />}}, and it will
work.
was (Author: ddekany):
It's because macro call tags always has to be explicitly closed (similarly to
XML tags), so {{<@testMacro "A">}} is a start-tag, and hence the enclosed
{{#else}} has no corresponding {{#if}}. Try {{<@testMacro "A" />}}, and it will
work.
> Can't use macro inside #if-#elseif-#else
> ----------------------------------------
>
> Key: FREEMARKER-9
> URL: https://issues.apache.org/jira/browse/FREEMARKER-9
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.23
> Environment: Windows 7
> Reporter: Henrik Karlsson
>
> When I put a call to a macro inside an #if-#elseif-#else I get this error:
> Unexpected directive, "<#else>". Check whether you have a valid
> #if-#elseif-#else structure.
> Example template:
> {noformat}
> <#macro testMacro value>
> ${value}
> </#macro>
> <#if (true)>
> <@testMacro "A">
> <#else>
> <@testMacro "B">
> </#if>
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)