fix(doc-util): ensure indexes get path prefixes (#36)

This commit is contained in:
Jeroen Op 't Eynde 2022-10-25 15:36:32 +02:00 committed by GitHub
parent 0486f08fc1
commit e7f3020f57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,12 @@
|||, |||,
}, },
joinPathPrefixes(prefixes, sep='/')::
std.join(sep, prefixes)
+ (if std.length(prefixes) > 0
then sep
else ''),
joinPrefixes(prefixes, sep='.'):: joinPrefixes(prefixes, sep='.')::
std.join(sep, prefixes) std.join(sep, prefixes)
+ (if std.length(prefixes) > 0 + (if std.length(prefixes) > 0
@ -345,14 +351,14 @@
if std.length(prefixes) > 0 if std.length(prefixes) > 0
then package.name + '.md' then package.name + '.md'
else 'README.md'; else 'README.md';
local path = root.joinPrefixes(prefixes, '/'); local path = root.joinPathPrefixes(prefixes);
{ {
[path + key]: root.renderPackage(package), [path + key]: root.renderPackage(package),
} }
+ ( + (
if std.length(package.subPackages) > 0 if std.length(package.subPackages) > 0
then { then {
[package.name + '/index.md']: root.renderIndexPage(package, prefixes), [path + package.name + '/index.md']: root.renderIndexPage(package, prefixes),
} }
else {} else {}
) )