hdoc-tools 0.32.1 → 0.33.1
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 +26 -20
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
@@ -40,7 +40,8 @@
|
|
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]
|
43
|
+
const regex_filename = /^[a-z]+[-a-z0-9]+$/;
|
44
|
+
const regex_filename_img = /^[a-z]+[_\-a-z0-9]+[a-z0-9]$/;
|
44
45
|
|
45
46
|
const built_file_hashes = [];
|
46
47
|
const css_templates = [];
|
@@ -1044,15 +1045,18 @@
|
|
1044
1045
|
const filename_validation_callback = (element) => {
|
1045
1046
|
if (element.relativePath.startsWith("_inline/")) return;
|
1046
1047
|
if (element.name.toLowerCase() === ".ds_store") return;
|
1047
|
-
if (
|
1048
|
-
|
1049
|
-
element.name === "description_ext.md"
|
1050
|
-
)
|
1051
|
-
return;
|
1052
|
-
if (image_extensions.includes(element.extension)) return;
|
1048
|
+
if (element.name === "article_ext.md" || element.name === "description_ext.md" ) return;
|
1049
|
+
|
1053
1050
|
const file_no_ext = element.name.replace(`.${element.extension}`, "");
|
1054
|
-
|
1055
|
-
|
1051
|
+
|
1052
|
+
if (image_extensions.includes(element.extension)) {
|
1053
|
+
if (!file_no_ext.match(regex_filename_img)) {
|
1054
|
+
errors_filename.push(element.relativePath);
|
1055
|
+
}
|
1056
|
+
return;
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
if (!file_no_ext.match(regex_filename)) errors_filename.push(element.relativePath);
|
1056
1060
|
};
|
1057
1061
|
|
1058
1062
|
const dreeOptions = {
|
@@ -1186,16 +1190,18 @@
|
|
1186
1190
|
prods_supported = prods.prods_supported;
|
1187
1191
|
}
|
1188
1192
|
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
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
|
+
}
|
1199
1205
|
}
|
1200
1206
|
|
1201
1207
|
if (!validate) {
|
@@ -1408,7 +1414,7 @@
|
|
1408
1414
|
gen_exclude,
|
1409
1415
|
redirects,
|
1410
1416
|
draft_links,
|
1411
|
-
github_repo_details.data.private,
|
1417
|
+
github_repo_details && github_repo_details.data && github_repo_details.data.private ? github_repo_details.data.private : false,
|
1412
1418
|
);
|
1413
1419
|
if (!validation_success) {
|
1414
1420
|
const end_time = Date.now();
|