Skip to content

Commit 0486f08

Browse files
authored
fix(render): only render index/fields sections if needed (#31)
1 parent be3cfab commit 0486f08

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

doc-util/render.libsonnet

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,16 @@
102102
]) + '\n\n'
103103
else ''
104104
)
105-
+ (root.templates.index % root.index(package.sections))
106-
+ '\n## Fields\n\n'
107-
+ root.renderValues(package.values)
108-
+ root.renderSections(package.sections),
105+
+ (if std.length(package.sections) > 0
106+
then (root.templates.index % root.index(package.sections))
107+
else '')
108+
+ (if std.length(package.values) > 0
109+
|| std.length(package.sections) > 0
110+
then
111+
'\n## Fields\n\n'
112+
+ root.renderValues(package.values)
113+
+ root.renderSections(package.sections)
114+
else ''),
109115

110116
index(sections, depth=0, prefixes=[])::
111117
std.join('\n', [

0 commit comments

Comments
 (0)