fix(render): only render index/fields sections if needed (#31)

This commit is contained in:
Jeroen Op 't Eynde 2022-10-24 09:12:59 +02:00 committed by GitHub
parent be3cfab4d8
commit 0486f08fc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,10 +102,16 @@
]) + '\n\n' ]) + '\n\n'
else '' else ''
) )
+ (root.templates.index % root.index(package.sections)) + (if std.length(package.sections) > 0
+ '\n## Fields\n\n' then (root.templates.index % root.index(package.sections))
else '')
+ (if std.length(package.values) > 0
|| std.length(package.sections) > 0
then
'\n## Fields\n\n'
+ root.renderValues(package.values) + root.renderValues(package.values)
+ root.renderSections(package.sections), + root.renderSections(package.sections)
else ''),
index(sections, depth=0, prefixes=[]):: index(sections, depth=0, prefixes=[])::
std.join('\n', [ std.join('\n', [