hdoc-tools 0.17.15 → 0.17.17
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/README.md +2 -0
- package/hdoc-build.js +1 -1
- package/hdoc-help.js +2 -1
- package/hdoc-module.js +2 -2
- package/hdoc-serve.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -37,6 +37,8 @@ Returns statistics regarding the book you are working on:
|
|
37
37
|
|
38
38
|
If the -v switch is provided, then more verbose output is output, which includes a list of each MD and HTML file found, the file sizes, and file-specific word count.
|
39
39
|
|
40
|
+
The book statistics do not include counts for any externally hosted content injected into the book content using the [[INCLUDE]] tags.
|
41
|
+
|
40
42
|
### build
|
41
43
|
|
42
44
|
Performs a local build of the book, validates the links and static content are present and correct and outputs as a ZIP file.
|
package/hdoc-build.js
CHANGED
@@ -307,7 +307,7 @@
|
|
307
307
|
let md_txt = hdoc.expand_variables(fs.readFileSync(file_path.path, 'utf8'));
|
308
308
|
|
309
309
|
// Pull in external includes
|
310
|
-
const includes_processed = await hdoc.process_includes(file_path.path, md_txt);
|
310
|
+
const includes_processed = await hdoc.process_includes(file_path.path, md_txt, global_source_path);
|
311
311
|
md_txt = includes_processed.body.toString();
|
312
312
|
includes_found += includes_processed.found;
|
313
313
|
includes_success += includes_processed.success;
|
package/hdoc-help.js
CHANGED
@@ -27,7 +27,8 @@ Commands
|
|
27
27
|
Starts a local web server on port 3000, serving the content. Supports a -port N to use a different port
|
28
28
|
|
29
29
|
- stats
|
30
|
-
Returns statistics regarding the book you are working on. Supports a -v switch for verbose output
|
30
|
+
Returns statistics regarding the book you are working on. Supports a -v switch for verbose output.
|
31
|
+
The book statistics do not include counts for any externally hosted content injected into the book content using the [[INCLUDE]] tags.
|
31
32
|
|
32
33
|
- validate
|
33
34
|
Validates the book content
|
package/hdoc-module.js
CHANGED
@@ -102,7 +102,7 @@
|
|
102
102
|
};
|
103
103
|
|
104
104
|
|
105
|
-
exports.process_includes = async function (file_path, body) {
|
105
|
+
exports.process_includes = async function (file_path, body, source_path) {
|
106
106
|
let response = {
|
107
107
|
body: '',
|
108
108
|
found: 0,
|
@@ -171,7 +171,7 @@
|
|
171
171
|
} else {
|
172
172
|
// Local content to include
|
173
173
|
try {
|
174
|
-
file_content = fs.readFileSync(path.join(
|
174
|
+
file_content = fs.readFileSync(path.join(source_path, link), 'utf8');
|
175
175
|
} catch (e) {
|
176
176
|
response.failed++;
|
177
177
|
response.errors.push(`Error getting INCLUDE file [${link}] from [${file_path}]: ${e}`);
|
package/hdoc-serve.js
CHANGED
@@ -14,10 +14,12 @@
|
|
14
14
|
let docId;
|
15
15
|
let hdocbook_config,
|
16
16
|
hdocbook_project,
|
17
|
-
inline_content = {}
|
17
|
+
inline_content = {},
|
18
|
+
global_source_path = '';
|
18
19
|
|
19
20
|
exports.run = async function (ui_path, source_path) {
|
20
21
|
|
22
|
+
global_source_path = source_path;
|
21
23
|
for (let x = 0; x < process.argv.length; x++) {
|
22
24
|
// First two arguments are command, and script
|
23
25
|
if (x == 0 || x == 1)
|
@@ -100,7 +102,7 @@
|
|
100
102
|
let md_txt = hdoc.expand_variables(fs.readFileSync(file_path).toString(), docId);
|
101
103
|
|
102
104
|
// Pull in external includes
|
103
|
-
const includes_processed = await hdoc.process_includes(file_path, md_txt);
|
105
|
+
const includes_processed = await hdoc.process_includes(file_path, md_txt, global_source_path);
|
104
106
|
md_txt = includes_processed.body;
|
105
107
|
if (includes_processed.errors && includes_processed.errors.length > 0) {
|
106
108
|
console.error(`Error(s) when processing includes in ${file_path}`);
|