{{- $maps := .maps -}} {{- $parentName := .parentName -}} {{- $useLinks := .useLinks -}} {{- $language := .language -}} {{- $depth := .depth | default 0 -}} {{- $parentPrefix := print $parentName "/" -}} {{/* Collect all descendants of the parent */}} {{- $descendants := slice -}} {{- range $item := $maps -}} {{- if hasPrefix $item.ModuleName $parentPrefix -}} {{- $descendants = $descendants | append $item -}} {{- end -}} {{- end -}} {{/* Find effective direct children: descendants with no intermediate ancestor in the data */}} {{- $effectiveChildren := slice -}} {{- range $desc := $descendants -}} {{- $hasAncestorInList := false -}} {{- range $other := $descendants -}} {{- if and (ne $other.ModuleName $desc.ModuleName) (hasPrefix $desc.ModuleName (print $other.ModuleName "/")) -}} {{- $hasAncestorInList = true -}} {{- end -}} {{- end -}} {{- if not $hasAncestorInList -}} {{- $effectiveChildren = $effectiveChildren | append $desc -}} {{- end -}} {{- end -}} {{- if $effectiveChildren -}} {{- if eq $depth 0 -}}
{{- end -}} {{- if eq $depth 0 -}}
{{- end -}} {{- end -}}