{{- /* Recursive function to render tree from structured data @param {array} items - Array of tree items @param {int} level - The expand level of the tree (expand all: -1, collapse all: 0) @param {int} [depth=0] - Current depth level @param {bool} [folderSlash=false] - Whether to append a trailing "/" to folder names @param {array} [ignoreList] - List of file or folder names to ignore @param {array} [highlightList] - List of file or folder names to highlight File tree item structure: name: string - The name of the file or folder type: string - Type of item, either "dir" (directory) or "file" children?: array - (Optional) Array of child items, only valid for directories */ -}} {{- define "render-file-tree" -}} {{- $items := .items -}} {{- $level := .level -}} {{- $depth := .depth | default 0 -}} {{- $folderSlash := .folderSlash | default false -}} {{- $ignoreList := .ignoreList | default slice -}} {{- $highlightList := .highlightList | default slice -}} {{- end -}} {{- if .items -}} {{- $ignoreList := .ignoreList | default slice -}} {{- $notEmpty := false -}} {{- range .items -}} {{- if not (in $ignoreList .name) -}} {{- $notEmpty = true -}} {{- break -}} {{- end -}} {{- end -}} {{- if $notEmpty -}}
{{- template "render-file-tree" . -}}
{{- end -}} {{- end -}}