在 XWiki 中的 {{html}} 内渲染速度以生成页面链接
Render Velocity inside {{html}} in XWiki to generate page links
我是 运行 XWiki,正在开发一个页面。我有一个 Velocity 脚本,在其中 {{html}} 并且在 html 中我使用的是 bootstrap 面板。我想要一个链接列表出现在面板中。简化后,它看起来像这样:
{{velocity}}
{{html}}
<div class="panel panel-primary">
<div class="panel-body">
<p> ... Display links from macro... </p>
</div>
</div>
{{/html}}
{{/velocity}}
宏给了我想要的链接:
#getChildrenOf("Classes.WebHome")
#macro(getChildrenOf, $docName)
#foreach($name in $xwiki.searchDocuments('where doc.parent = ? or doc.parent = ? order by doc.name', [$docName, "xwiki:$docName"]))
#if($xwiki.hasAccessLevel('view', "xwiki:$name"))
[[$xwiki.getDocument($name).getPlainTitle()>>$name]]
#else
$xwiki.getDocument($name).getPlainTitle()
#end
#getChildrenOf($name)
#end
#end
输出为:
[[完成>>Classes.COMPLETE]] [[域>>Classes.DOMAIN]] [[级别>>Classes.LEVEL]]
呈现为 HTML 文本。如何在 HTML 中将其渲染为速度?如果我关闭 HTML around the velocity 它会破坏 HTML 面板,因为 HTML 标签不会关闭。我可以以某种方式出售变量中的列表并将其显示在面板中吗?
谢谢!
只需用标签替换 [[s 并调用速度函数即可解决问题。
<a href="$xwiki.getURL($name)">$xwiki.getDocument($name).getPlainTitle()</a><br>
如果您想在 {{html}}
-宏中解释 Wiki 语法,您需要使用 wiki="true"
参数,例如:
{{velocity}}
{{html wiki="true"}}
<div class="panel panel-primary">
<div class="panel-body">
<p> Link to home page: [[WebHome]] </p>
</div>
</div>
{{/html}}
{{/velocity}}
如果省略此参数,它默认为 wiki="false"
- 即 Wiki-Syntax 不在宏内部解释。
{{html}}
-宏参考及其参数:http://extensions.xwiki.org/xwiki/bin/view/Extension/HTML+Macro
我是 运行 XWiki,正在开发一个页面。我有一个 Velocity 脚本,在其中 {{html}} 并且在 html 中我使用的是 bootstrap 面板。我想要一个链接列表出现在面板中。简化后,它看起来像这样:
{{velocity}}
{{html}}
<div class="panel panel-primary">
<div class="panel-body">
<p> ... Display links from macro... </p>
</div>
</div>
{{/html}}
{{/velocity}}
宏给了我想要的链接:
#getChildrenOf("Classes.WebHome")
#macro(getChildrenOf, $docName)
#foreach($name in $xwiki.searchDocuments('where doc.parent = ? or doc.parent = ? order by doc.name', [$docName, "xwiki:$docName"]))
#if($xwiki.hasAccessLevel('view', "xwiki:$name"))
[[$xwiki.getDocument($name).getPlainTitle()>>$name]]
#else
$xwiki.getDocument($name).getPlainTitle()
#end
#getChildrenOf($name)
#end
#end
输出为:
[[完成>>Classes.COMPLETE]] [[域>>Classes.DOMAIN]] [[级别>>Classes.LEVEL]]
呈现为 HTML 文本。如何在 HTML 中将其渲染为速度?如果我关闭 HTML around the velocity 它会破坏 HTML 面板,因为 HTML 标签不会关闭。我可以以某种方式出售变量中的列表并将其显示在面板中吗?
谢谢!
只需用标签替换 [[s 并调用速度函数即可解决问题。
<a href="$xwiki.getURL($name)">$xwiki.getDocument($name).getPlainTitle()</a><br>
如果您想在 {{html}}
-宏中解释 Wiki 语法,您需要使用 wiki="true"
参数,例如:
{{velocity}}
{{html wiki="true"}}
<div class="panel panel-primary">
<div class="panel-body">
<p> Link to home page: [[WebHome]] </p>
</div>
</div>
{{/html}}
{{/velocity}}
如果省略此参数,它默认为 wiki="false"
- 即 Wiki-Syntax 不在宏内部解释。
{{html}}
-宏参考及其参数:http://extensions.xwiki.org/xwiki/bin/view/Extension/HTML+Macro