hdoc-tools 0.4.0 → 0.5.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 +11 -1
- package/hdoc-serve.js +1 -0
- package/hdoc.js +16 -8
- package/package.json +3 -4
package/hdoc-build.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
exports.run = function(ui_path, source_path, md) {
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// GERRY: The purpose of this function is to create a zip file containing the hdocbook content,
|
|
5
|
+
// * Create a _work folder
|
|
6
|
+
// * copy the hdocbook content to the work folder
|
|
7
|
+
// * Render all markdown into side-by-side HTML file
|
|
8
|
+
// * Replace SERVER_VARS embedded in documents with the right base path, version information etc.
|
|
9
|
+
// * Build an index (sqlite FTS5) by extracting text from all HTML content in the work
|
|
10
|
+
// folder, conceptually we are making a little mini websirte crawler to index all of the content
|
|
11
|
+
// within the book.
|
|
12
|
+
// * Package everything up into a ZIP file, ready for the build controller to package and publish
|
|
13
|
+
|
|
4
14
|
console.log("Build is not yet implemented")
|
|
5
15
|
}
|
package/hdoc-serve.js
CHANGED
|
@@ -4,6 +4,7 @@ const stream = require('stream');
|
|
|
4
4
|
var express = require('express');
|
|
5
5
|
|
|
6
6
|
exports.run = function(ui_path, source_path, md) {
|
|
7
|
+
|
|
7
8
|
console.log("Hornbill HDocBook Preview/Dev Server", "\r\n");
|
|
8
9
|
console.log(" Server Path:", __dirname);
|
|
9
10
|
console.log(" UI Root Path:", ui_path);
|
package/hdoc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
var path = require('path');
|
|
@@ -19,6 +19,7 @@ const md = require('markdown-it') ({
|
|
|
19
19
|
// }
|
|
20
20
|
// }
|
|
21
21
|
});
|
|
22
|
+
const html2text = require('html-to-text');
|
|
22
23
|
|
|
23
24
|
var frontmatter_content;
|
|
24
25
|
md.use(mdfm, function(fm) {
|
|
@@ -35,10 +36,7 @@ const ui_path = path.join(__dirname, "ui");
|
|
|
35
36
|
|
|
36
37
|
var command = ""; // Our command to run
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
"serve": {},
|
|
40
|
-
"build": {}
|
|
41
|
-
};
|
|
39
|
+
|
|
42
40
|
|
|
43
41
|
// Get options from command args
|
|
44
42
|
for(x = 0; x < process.argv.length; x++)
|
|
@@ -49,9 +47,7 @@ for(x = 0; x < process.argv.length; x++)
|
|
|
49
47
|
// Third argument is command
|
|
50
48
|
if(x == 2) {
|
|
51
49
|
command = process.argv[x];
|
|
52
|
-
|
|
53
|
-
if(commands[command] === undefined)
|
|
54
|
-
throw "The specified command '" + command + "' is not known\r\n";
|
|
50
|
+
continue;
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
if(process.argv[x] == "-path") {
|
|
@@ -82,5 +78,17 @@ if(command == "serve") {
|
|
|
82
78
|
const builder = require(path.join(__dirname, "hdoc-build.js"));
|
|
83
79
|
|
|
84
80
|
builder.run(ui_path, source_path, md);
|
|
81
|
+
} else if(command == "stats") {
|
|
82
|
+
|
|
83
|
+
const stats = require(path.join(__dirname, "hdoc-stats.js"));
|
|
84
|
+
|
|
85
|
+
stats.run(ui_path, source_path, md);
|
|
86
|
+
} else if(command == "init") {
|
|
87
|
+
|
|
88
|
+
const init = require(path.join(__dirname, "hdoc-init.js"));
|
|
89
|
+
|
|
90
|
+
init.run(ui_path, source_path, md);
|
|
91
|
+
} else {
|
|
92
|
+
console.log("Unknown command: " + command);
|
|
85
93
|
}
|
|
86
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hdoc-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Hornbill HDocBook Development Support Tool",
|
|
5
5
|
"main": "hdoc.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,14 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"author": "Hornbill Technologies Ltd",
|
|
20
20
|
"license": "ISC",
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
},
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"hdoc-tools": "^0.1.0",
|
|
25
22
|
"body-parser": "^1.20.1",
|
|
26
23
|
"cookie-parser": "^1.4.6",
|
|
27
24
|
"express": "^4.18.2",
|
|
25
|
+
"hdoc-tools": "^0.1.0",
|
|
28
26
|
"highlight.js": "^11.6.0",
|
|
27
|
+
"html-to-text": "^8.2.1",
|
|
29
28
|
"js-yaml": "^4.1.0",
|
|
30
29
|
"markdown-it": "^13.0.1",
|
|
31
30
|
"markdown-it-container": "^3.0.0",
|