渲染 HTML inside velocity includeInContext() XWiki

Render HTML inside velocity includeInContext() XWiki

我有两个空格。一个是 "view" 页面,另一个是 "tool" 页面。我想通过我的 wiki 在视图的上下文中在各种 "view" 页面上呈现 "tool"。目前,在 "view" 页面中我使用:

{{velocity}}
#includeInContext("Interfaces.tool.WebHome")
{{/velocity}}

这很好用,我可以使用 "tool" 页面中的代码检索 "view" 页面的子项或数据,这正是我想要的。

但是,如果我包含:

{{velocity}}

 {{html wiki="true"}}
   <tag ... html></tag>
 {{/html}}

{{/velocity}}

在 "tool" 页面中,html 仅在 "view" 页面中呈现为文本。我也试过将 {{html}} 标签移动到 "view" 页面或 wiki="false" 但没有成功。还有其他想法可以尝试吗?也许是 includeInContext() 以外的其他函数?

#includeInContext 已部分弃用。您应该使用新的 {{include}} wiki 宏,在您的情况下它看起来像:

{{include reference="Interfaces.tool.WebHome"/}}

您也不需要视图页面中的 {{velocity}} 包装器,只需要 {{include}} 宏。