hdoc-tools 0.33.0 → 0.33.2
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 +14 -12
- package/hdoc-validate.js +6 -1
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
const pdf_template_file_path = path.join(pdf_template_path, "template.html");
|
41
41
|
const regex_version = /^[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,6}$/;
|
42
42
|
const h1_pattern = /(<h1.*?>)\s*.*\s*(.*<\/h1>)/;
|
43
|
-
const regex_filename = /^[a-z]+[-a-z0-9]
|
43
|
+
const regex_filename = /^[a-z]+[-a-z0-9]+$/;
|
44
44
|
const regex_filename_img = /^[a-z]+[_\-a-z0-9]+[a-z0-9]$/;
|
45
45
|
|
46
46
|
const built_file_hashes = [];
|
@@ -1190,16 +1190,18 @@
|
|
1190
1190
|
prods_supported = prods.prods_supported;
|
1191
1191
|
}
|
1192
1192
|
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1193
|
+
if (hdocbook_config.publicSource && hdocbook_config.publicSource.includes('github')) {
|
1194
|
+
const clean_repo = hdocbook_config.publicSource.endsWith("/") ? hdocbook_config.publicSource.slice(0, -1) : hdocbook_config.publicSource;
|
1195
|
+
const api_path = clean_repo.replace(
|
1196
|
+
"https://github.com/",
|
1197
|
+
"https://api.github.com/repos/",
|
1198
|
+
);
|
1199
|
+
|
1200
|
+
// Get github repo details
|
1201
|
+
github_repo_details = await hdoc.get_github_repo_details( api_path, git_token );
|
1202
|
+
if (github_repo_details.success) {
|
1203
|
+
console.warn(`Unable to retrieve GitHub Repository details: ${github_repo_details.error}`);
|
1204
|
+
}
|
1203
1205
|
}
|
1204
1206
|
|
1205
1207
|
if (!validate) {
|
@@ -1412,7 +1414,7 @@
|
|
1412
1414
|
gen_exclude,
|
1413
1415
|
redirects,
|
1414
1416
|
draft_links,
|
1415
|
-
github_repo_details.data.private,
|
1417
|
+
github_repo_details && github_repo_details.data && github_repo_details.data.private ? github_repo_details.data.private : false,
|
1416
1418
|
);
|
1417
1419
|
if (!validation_success) {
|
1418
1420
|
const end_time = Date.now();
|
package/hdoc-validate.js
CHANGED
@@ -571,7 +571,12 @@ const e = require("express");
|
|
571
571
|
`Link is a valid external URL: ${links[i]}`,
|
572
572
|
);
|
573
573
|
} catch (e) {
|
574
|
-
|
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
|
+
}
|
575
580
|
errors[htmlFile.relativePath].push(error_message);
|
576
581
|
}
|
577
582
|
}
|