从Freemarker节点逐字插入HTML

时间:2015-08-12 21:08:45

标签: freemarker

我有以下Freemarker代码:

    <#macro table_container>
        <div class="table content">
            ${.node}
        </div>
    </#macro>

现在节点包含我不希望由Freemarker解析的HTML(用于表)。我只想按原样插入。目前我收到此错误:

freemarker.template.TemplateModelException: Only elements with no child elements can be 
processed as text.
This element with name "table_container" has a child element named: table

如何让Freemarker逐字插入此HTML?

1 个答案:

答案 0 :(得分:1)

${.node.@@markup},或者如果你在#escape内,<#noescape>${.node.@@markup}</#noescape>。虽然它会为每次插入添加所需的xmlns属性,但它具有轻微的丑陋。