hdoc-tools 0.8.5 → 0.8.7

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 CHANGED
@@ -312,6 +312,7 @@ const {
312
312
  console.log('Performing SQlite index creation...');
313
313
  let db_name = path.join(work_path, docId, 'index.db');
314
314
  const db = new Database(db_name);
315
+ db.pragma('encoding="UTF-8"');
315
316
  console.log(`\nDatabase created: ${db_name}`);
316
317
 
317
318
  // Now add the table
package/hdoc-db.js CHANGED
@@ -1,8 +1,7 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- const ellipsize = require('ellipsize'),
5
- html2text = require('html-to-text'),
4
+ const html2text = require('html-to-text'),
6
5
  path = require('path'),
7
6
  hdoc = require(path.join(__dirname, 'hdoc-module.js'));
8
7
 
@@ -84,7 +83,7 @@
84
83
  uppercaseHeadings: false,
85
84
  wordwrap: null
86
85
  });
87
- response.preview = ellipsize(response.preview, 200).replace(/(?:\r\n|\r|\n)/g, ' ');
86
+ response.preview = hdoc.truncate_string(response.preview, 200, true).replace(/(?:\r\n|\r|\n)/g, ' ');
88
87
  return response;
89
88
  };
90
89
 
package/hdoc-module.js CHANGED
@@ -191,4 +191,10 @@
191
191
  }
192
192
  return response;
193
193
  };
194
+
195
+ exports.truncate_string = function( str, n, useWordBoundary ){
196
+ if (str.length <= n) { return str; }
197
+ const subString = str.slice(0, n-1);
198
+ return (useWordBoundary ? subString.slice(0, subString.lastIndexOf(" ")) : subString) + '…';
199
+ };
194
200
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {
@@ -33,7 +33,6 @@
33
33
  "cheerio": "^1.0.0-rc.12",
34
34
  "cookie-parser": "^1.4.6",
35
35
  "dree": "^3.4.2",
36
- "ellipsize": "^0.5.1",
37
36
  "express": "^4.18.2",
38
37
  "fs-extra": "^11.1.0",
39
38
  "highlight.js": "^11.6.0",