hdoc-tools 0.17.27 → 0.17.29
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 +9 -3
- package/package.json +1 -1
- package/templates/init/gitignore +1 -0
package/hdoc-build.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
const { extension } = require("mime-types");
|
2
|
-
|
3
1
|
(function () {
|
4
2
|
"use strict";
|
5
3
|
|
@@ -19,6 +17,7 @@ const { extension } = require("mime-types");
|
|
19
17
|
xmlFormat = require("xml-formatter");
|
20
18
|
|
21
19
|
const h_tags_to_search = ["h1", "h2", "h3"],
|
20
|
+
image_extensions = [ 'png', 'svg', 'jpg' ],
|
22
21
|
doc_header_template_path = path.join(
|
23
22
|
__dirname,
|
24
23
|
"templates",
|
@@ -1030,11 +1029,14 @@ const { extension } = require("mime-types");
|
|
1030
1029
|
// File scan callback for filename validation
|
1031
1030
|
const filename_validation_callback = function (element) {
|
1032
1031
|
if (element.relativePath.startsWith('_inline/')) return;
|
1032
|
+
if (element.name.toLowerCase() === '.ds_store') return;
|
1033
1033
|
if (element.name === 'article_ext.md' || element.name === 'description_ext.md') return;
|
1034
|
+
if (image_extensions.includes(element.extension)) return;
|
1034
1035
|
const file_no_ext = element.name.replace(`.${element.extension}`, '');
|
1035
1036
|
if (!file_no_ext.match(regex_filename)) errors_filename.push(element.relativePath);
|
1036
1037
|
};
|
1037
1038
|
|
1039
|
+
|
1038
1040
|
const dreeOptions = {
|
1039
1041
|
hash: true,
|
1040
1042
|
extensions: ["md", "html", "htm"],
|
@@ -1210,10 +1212,14 @@ const { extension } = require("mime-types");
|
|
1210
1212
|
}
|
1211
1213
|
fs.mkdirSync(work_path);
|
1212
1214
|
|
1215
|
+
const file_filter = (src) => {
|
1216
|
+
return !src.toLowerCase().endsWith('.ds_store');
|
1217
|
+
};
|
1218
|
+
|
1213
1219
|
// Copy files from book into _work-doc_id folder
|
1214
1220
|
console.log(`Copying content into work folder...`);
|
1215
1221
|
try {
|
1216
|
-
fs.copySync(path.join(source_path, doc_id), work_path_content);
|
1222
|
+
fs.copySync(path.join(source_path, doc_id), work_path_content, { filter: file_filter });
|
1217
1223
|
} catch (e) {
|
1218
1224
|
console.error("Error copying from source_path:\n", e);
|
1219
1225
|
process.exit(1);
|
package/package.json
CHANGED