hdoc-tools 0.6.8 → 0.6.9

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-help.js CHANGED
@@ -7,20 +7,24 @@
7
7
  const helpText = `
8
8
  Command Line Usage
9
9
 
10
- hdoc argument switches
10
+ hdoc <command> [switches]
11
11
 
12
- Arguments
12
+ Commands
13
13
 
14
- - help
14
+ - help
15
15
  Outputs available arguments and switches
16
- - init
16
+
17
+ - init
17
18
  Initializes a new HDocBook project from a template, using runtime input variables
18
- - stats
19
+
20
+ - stats
19
21
  Returns statistics regarding the book you are working on. Supports a -v switch for verbose output
20
- - build
22
+
23
+ - build
21
24
  Performs a local build of the book, and outputs as a ZIP file.
22
- - serve
23
- Starts a local web server on port 3000, serving the book content.
25
+
26
+ - serve
27
+ Starts a local web server on port 3000, serving the content. Supports a -port N to use a different port
24
28
 
25
29
  Example
26
30
 
package/hdoc-serve.js CHANGED
@@ -5,13 +5,28 @@
5
5
  var path = require('path');
6
6
  const stream = require('stream');
7
7
  var express = require('express');
8
+ var port = 3000;
8
9
 
9
10
  exports.run = function (ui_path, source_path, md) {
10
11
 
12
+ for (let x = 0; x < process.argv.length; x++) {
13
+ // First two arguments are command, and script
14
+ if (x == 0 || x == 1)
15
+ continue;
16
+
17
+ if (process.argv[x] == '-port') {
18
+ x++;
19
+ if (x < process.argv.length) {
20
+ port = process.argv[x];
21
+ }
22
+ }
23
+ }
24
+
11
25
  console.log('Hornbill HDocBook Preview/Dev Server', '\r\n');
12
- console.log(' Server Path:', __dirname);
13
- console.log(' UI Root Path:', ui_path);
26
+ //console.log(' Server Path:', __dirname);
27
+ //console.log(' UI Root Path:', ui_path);
14
28
  console.log(' Document Path:', source_path, '\r\n');
29
+ console.log(' Server Port:', port);
15
30
 
16
31
  // Get an express server instance
17
32
  var app = express();
@@ -44,7 +59,6 @@
44
59
  res.send(JSON.stringify(library, null, 3));
45
60
  });
46
61
 
47
-
48
62
  function content_type_for_ext(ext) {
49
63
  switch (ext) {
50
64
  case '.z':
@@ -351,11 +365,11 @@
351
365
  send_content_resource_404(req, res);
352
366
  });
353
367
 
354
- var server = app.listen(3000, '0.0.0.0', function () {
368
+ var server = app.listen(port, '0.0.0.0', function () {
355
369
  var host = server.address().address;
356
370
  var port = server.address().port;
357
371
 
358
- console.log('Server listening at http://%s:%s', host, port);
372
+ console.log('Server listening at http://127.0.0.1:%s', port);
359
373
  console.log('Document source path is: ' + source_path);
360
374
  });
361
375
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {