hdoc-tools 0.33.1 → 0.33.3
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-serve.js +0 -1
- package/hdoc-validate.js +13 -4
- package/package.json +1 -1
- package/ui/js/doc.hornbill.js +4 -3
package/hdoc-serve.js
CHANGED
package/hdoc-validate.js
CHANGED
@@ -449,7 +449,7 @@ const e = require("express");
|
|
449
449
|
return returnPaths;
|
450
450
|
}
|
451
451
|
|
452
|
-
const checkLinks = async (source_path, htmlFile, links, hdocbook_config) => {
|
452
|
+
const checkLinks = async (source_path, htmlFile, links, hdocbook_config, hdocbook_project) => {
|
453
453
|
const markdown_paths = getMDPathFromHtmlPath(htmlFile);
|
454
454
|
const markdown_content = fs.readFileSync(markdown_paths.markdownPath, 'utf8');
|
455
455
|
|
@@ -571,8 +571,17 @@ const e = require("express");
|
|
571
571
|
`Link is a valid external URL: ${links[i]}`,
|
572
572
|
);
|
573
573
|
} catch (e) {
|
574
|
-
|
575
|
-
|
574
|
+
let error_message;
|
575
|
+
if (e instanceof AggregateError) {
|
576
|
+
error_message = processErrorMessage(`Issue with external link [${links[i]}]: ${e.message} - ${JSON.stringify(e.errors)}`, markdown_paths.relativePath, markdown_content, links[i]);
|
577
|
+
} else {
|
578
|
+
error_message = processErrorMessage(`Issue with external link [${links[i]}]: ${e}`, markdown_paths.relativePath, markdown_content, links[i]);
|
579
|
+
}
|
580
|
+
if (hdocbook_project.validation.external_link_warnings)
|
581
|
+
warnings[htmlFile.relativePath].push(error_message);
|
582
|
+
else
|
583
|
+
errors[htmlFile.relativePath].push(error_message);
|
584
|
+
|
576
585
|
}
|
577
586
|
}
|
578
587
|
}
|
@@ -993,7 +1002,7 @@ const e = require("express");
|
|
993
1002
|
if (links.href.length === 0) {
|
994
1003
|
messages[file.relativePath].push("No links found in file");
|
995
1004
|
} else {
|
996
|
-
await checkLinks(source_path, file, links.href, hdocbook_config);
|
1005
|
+
await checkLinks(source_path, file, links.href, hdocbook_config, hdocbook_project);
|
997
1006
|
}
|
998
1007
|
if (links.img.length === 0) {
|
999
1008
|
messages[file.relativePath].push("No images found in file");
|
package/package.json
CHANGED
package/ui/js/doc.hornbill.js
CHANGED
@@ -258,6 +258,8 @@ function loadContentUrl(
|
|
258
258
|
fromPopState,
|
259
259
|
fromBook = true,
|
260
260
|
) {
|
261
|
+
|
262
|
+
|
261
263
|
//-- clear table of contents
|
262
264
|
view.docApp.tableOfContents = [];
|
263
265
|
let clean_linkRef = linkRef;
|
@@ -686,17 +688,16 @@ async function intialiseApp() {
|
|
686
688
|
`${window.location.origin}/`,
|
687
689
|
"",
|
688
690
|
);
|
689
|
-
|
691
|
+
const newInitialLoadContentHref = findFirstClickableBookLink(
|
690
692
|
initialLoadContentHref,
|
691
693
|
);
|
692
|
-
|
694
|
+
if (newInitialLoadContentHref !== undefined) initialLoadContentHref = newInitialLoadContentHref;
|
693
695
|
if (initialLoadContentHref) {
|
694
696
|
//-- find the link we are going to show and make sure parent/s are set to .expand=true
|
695
697
|
loadContentUrl(initialLoadContentHref, true, false);
|
696
698
|
} else {
|
697
699
|
hslDocLog.log("initial first view link to load is not present");
|
698
700
|
}
|
699
|
-
|
700
701
|
$(".hb-hidden").removeClass("hb-hidden");
|
701
702
|
}, 200);
|
702
703
|
})
|