hdoc-tools 0.17.20 → 0.17.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hdoc-build.js +11 -2
- package/hdoc-module.js +13 -3
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
@@ -923,8 +923,17 @@
|
|
923
923
|
}
|
924
924
|
}
|
925
925
|
console.log(`Processing navigation breadcrumbs...`);
|
926
|
-
|
927
|
-
|
926
|
+
const bc_build = hdoc.build_breadcrumbs(hdocbook_config.navigation.items);
|
927
|
+
if (bc_build.errors.length > 0) {
|
928
|
+
console.log('\r\n-----------------------');
|
929
|
+
console.log(' Validation Output ');
|
930
|
+
console.log('-----------------------');
|
931
|
+
console.log(`\n${bc_build.errors.length} errors found when processing navigation:\n`);
|
932
|
+
console.log(` - ${bc_build.errors.join('\n\n - ')}`);
|
933
|
+
console.log('\n');
|
934
|
+
process.exit(1);
|
935
|
+
}
|
936
|
+
bc = bc_build.bc;
|
928
937
|
console.log(`Processing content...`);
|
929
938
|
// Get a list of MD files in work_path
|
930
939
|
dree.scan(work_path, dreeOptions, build_file_callback);
|
package/hdoc-module.js
CHANGED
@@ -424,7 +424,10 @@
|
|
424
424
|
};
|
425
425
|
|
426
426
|
exports.build_breadcrumbs = function (nav_items) {
|
427
|
-
|
427
|
+
let response = {
|
428
|
+
bc: {},
|
429
|
+
errors: []
|
430
|
+
};
|
428
431
|
const buildBreadcrumb = (items, parentLinks) => {
|
429
432
|
|
430
433
|
// Process parent links
|
@@ -441,6 +444,13 @@
|
|
441
444
|
|
442
445
|
// Loop through items, build breadcrumb
|
443
446
|
for (let i = 0; i < items.length; i++) {
|
447
|
+
if (!items[i].text) {
|
448
|
+
response.errors.push(`The following Nav Item is missing its text property: ${JSON.stringify(items[i])}`);
|
449
|
+
}
|
450
|
+
|
451
|
+
if (!items[i].link && !items[i].items) {
|
452
|
+
response.errors.push(`The following Nav Item is missing has no link or items property: ${JSON.stringify(items[i])}`);
|
453
|
+
}
|
444
454
|
const item = items[i];
|
445
455
|
if (!parentlink && item.link) {
|
446
456
|
parentLinks[0].link = item.link;
|
@@ -450,7 +460,7 @@
|
|
450
460
|
const breadcrumb = [...parentLinks, { text, link }];
|
451
461
|
|
452
462
|
if (link) {
|
453
|
-
bc[link] = breadcrumb;
|
463
|
+
response.bc[link] = breadcrumb;
|
454
464
|
}
|
455
465
|
|
456
466
|
if (subItems) {
|
@@ -460,7 +470,7 @@
|
|
460
470
|
};
|
461
471
|
|
462
472
|
buildBreadcrumb(nav_items, []);
|
463
|
-
return
|
473
|
+
return response;
|
464
474
|
};
|
465
475
|
|
466
476
|
exports.load_product_families = async function () {
|