Hierarchical data in StringTemplate

I am trying to create a hierarchical document using a StringTemplate.

For example, a list of directories:

\alpha 
   \file1
   \file2
\beta
   \file3
\gamma
   \file4
   \file5
   \file6

Is this possible with StringTemplate?

+3
source share
1 answer

A simple example would be:

list.st

$it.title$
    $it.children:list()$

page.st

$rootNode.children:list()$

For more information, you can read Introduction to StringTemplate (as well as Collections and Template Groups and Complex Data Types and Renders in this trilogy). And don't forget the official StringTemplate documentation .

+2
source

Source: https://habr.com/ru/post/1761709/


All Articles