StringTemplate中的分层数据
问题描述:
我正在尝试使用StringTemplate创建分层文档。StringTemplate中的分层数据
例如,目录列表:
\alpha
\file1
\file2
\beta
\file3
\gamma
\file4
\file5
\file6
这甚至可能与StringTemplate的?
答
简单的例子是:
list.st
$it.title$
$it.children:list()$
page.st
$rootNode.children:list()$
欲了解更多信息,可以阅读An introduction to StringTemplate(以及Collections and Template Groups这三部曲中的Complex Data Types and Renderers)。别忘了official StringTemplate documentation。