我正在运行XWiki并开发一个页面。我有一个Velocity脚本并在其中{{html}}并在html中我使用了一个引导程序面板。我想要一个链接列表出现在面板中。简化,它看起来像这样:
{{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
输出结果为:
[[COMPLETE&gt;&gt; Classes.COMPLETE]] [[DOMAIN&gt;&gt; Classes.DOMAIN]] [[LEVEL&gt;&gt; Classes.LEVEL]]
呈现为HTML文字。如何在HTML中将其渲染为速度?如果我关闭HTML acround的速度,它会破坏HTML面板,因为HTML标签不会关闭。我可以以某种方式销售变量中的列表并将其显示在面板中吗?
谢谢!
答案 0 :(得分:2)
如果您希望在wiki="true"
- 宏中解释Wiki语法,则需要使用{{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"
如果省略此参数,则默认为{{html}}
- 即不在宏内解释Wiki-Syntax。
参考Mapper.CreateMap<CalculationQueryResult, CalculationViewModel>()
.ForMember(poco => poco.NomineeFee,
opt => opt.ResolveUsing<FormattedCurrencyInt>()
.FromMember(m => m.NomineeFee))
.ForMember(poco => poco.TotalContributions,
opt => opt.ResolveUsing<FormattedCurrencyInt>()
.FromMember(m => m.TotalContributions))
.ForMember(poco => poco.EquityInjection,
opt => opt.ResolveUsing<FormattedCurrencyInt>()
.FromMember(m => m.EquityInjection))
// ... SNIP Lots more members mapped with Formatted Currency Resolver
- 宏查看及其参数:http://extensions.xwiki.org/xwiki/bin/view/Extension/HTML+Macro
答案 1 :(得分:0)
简单地替换[[带标签的s并调用速度功能解决了问题。
<a href="$xwiki.getURL($name)">$xwiki.getDocument($name).getPlainTitle()</a><br>