【发布时间】:2017-03-13 07:18:08
【问题描述】:
我目前有以下结构:
List<List<ClusterEntry>> clusters = new ArrayList<List<ClusterEntry>>();
//fill clusters and the list in clusters
input.put("clusters", clusters);
clusters 描述了我的集群,而 cluster.get(i) 包含一个集群中的所有元素。对于报告,我想使用 freemarker 将此结果输出到 .md 文件中。目标是具有与集群一样多的列,并且在每一行中都有一个相应集群的条目。 我面临的问题是,我必须从外部列表开始,即集群:
|<#list clusters as c> Cluster ${c_index} | </#list>
|<#list clusters as c>-----|</#list>
这是我将标题放在一行中的解决方案。如果我这样做:
|<#list clusters as c> Cluster ${c_index} |
</#list>
我的输出将是每个集群 ${c_index} 的单独行
所以现在我为每个集群名称都有一个列,但是如何填写相应行中的条目?我需要每个不同集群在其相应的单独列中的条目,但我不知道如何使用 freemarker 实现这一点,如下代码:
<#list clusters as c>
<#list c as entry>| ${entry.id} |</#list>
</#list>
将导致一个集群的条目在一行中,而下一个集群在下一行。我想要这个,但有列
【问题讨论】:
标签: java markdown freemarker