hdoc-tools 0.8.5 → 0.8.8
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
|
@@ -18,13 +18,14 @@ const {
|
|
|
18
18
|
|
|
19
19
|
const h_tags_to_search = ['h1', 'h2', 'h3'],
|
|
20
20
|
index_cols = [
|
|
21
|
-
'relative_url',
|
|
21
|
+
'relative_url UNINDEXED',
|
|
22
22
|
'book_id',
|
|
23
|
-
'book_audience',
|
|
23
|
+
'book_audience UNINDEXED',
|
|
24
24
|
'book_tags',
|
|
25
25
|
'doc_title',
|
|
26
26
|
'doc_content',
|
|
27
|
-
'doc_preview'
|
|
27
|
+
'doc_preview UNINDEXED',
|
|
28
|
+
'doc_family_id'
|
|
28
29
|
];
|
|
29
30
|
|
|
30
31
|
let conversion_attempted = 0,
|
|
@@ -312,6 +313,7 @@ const {
|
|
|
312
313
|
console.log('Performing SQlite index creation...');
|
|
313
314
|
let db_name = path.join(work_path, docId, 'index.db');
|
|
314
315
|
const db = new Database(db_name);
|
|
316
|
+
db.pragma('encoding="UTF-8"');
|
|
315
317
|
console.log(`\nDatabase created: ${db_name}`);
|
|
316
318
|
|
|
317
319
|
// Now add the table
|
|
@@ -335,6 +337,7 @@ const {
|
|
|
335
337
|
index_records[i].index_html.fm_props.title,
|
|
336
338
|
index_records[i].index_html.text,
|
|
337
339
|
index_records[i].index_html.preview,
|
|
340
|
+
hdocbook_config.productFamily
|
|
338
341
|
];
|
|
339
342
|
const index_response = hdoc_index.insert_record(db, table_name, index_cols, index_vals, hdocbook_config.docId, index_records[i].index_html.fm_props.title);
|
|
340
343
|
if (!index_response.success) {
|
package/hdoc-db.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const
|
|
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
|
|
|
@@ -34,10 +33,10 @@
|
|
|
34
33
|
let vals = 'VALUES (';
|
|
35
34
|
for (let i = 0; i < columns.length; i++) {
|
|
36
35
|
if (i === 0) {
|
|
37
|
-
cols += `${columns[i]}`;
|
|
36
|
+
cols += `${columns[i].replace('UNINDEXED', '').trim()}`;
|
|
38
37
|
vals += '?';
|
|
39
38
|
} else {
|
|
40
|
-
cols += `,${columns[i]}`;
|
|
39
|
+
cols += `,${columns[i].replace('UNINDEXED', '').trim()}`;
|
|
41
40
|
vals += ',?';
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
uppercaseHeadings: false,
|
|
85
84
|
wordwrap: null
|
|
86
85
|
});
|
|
87
|
-
response.preview =
|
|
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-init.js
CHANGED
|
@@ -71,9 +71,6 @@
|
|
|
71
71
|
process.exit(1);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
// The file update tasks can now all be done async now
|
|
75
|
-
// we have the file and folder structure in place
|
|
76
|
-
|
|
77
74
|
// Update hdocbook-project.json
|
|
78
75
|
const hdocBookProjectFilePath = path.join(source_path, 'hdocbook-project.json');
|
|
79
76
|
const hdocBookProjectFile = require(hdocBookProjectFilePath);
|
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.
|
|
3
|
+
"version": "0.8.8",
|
|
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",
|
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
"title": "--title--",
|
|
4
4
|
"description": "--description--",
|
|
5
5
|
"publicSource": "--publicSource--",
|
|
6
|
+
"productFamily": "docs",
|
|
6
7
|
"version": "0.0.1",
|
|
8
|
+
"audience": [
|
|
9
|
+
"public"
|
|
10
|
+
],
|
|
11
|
+
"languages": [
|
|
12
|
+
"en"
|
|
13
|
+
],
|
|
7
14
|
"navigation": {
|
|
8
15
|
"items": [
|
|
9
16
|
{
|
|
@@ -11,5 +18,6 @@
|
|
|
11
18
|
"expand": true
|
|
12
19
|
}
|
|
13
20
|
]
|
|
14
|
-
}
|
|
21
|
+
},
|
|
22
|
+
"tags": []
|
|
15
23
|
}
|
|
@@ -34,6 +34,36 @@
|
|
|
34
34
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/* nav tabs in doc content */
|
|
38
|
+
.DocContent .nav-tabs
|
|
39
|
+
{
|
|
40
|
+
padding-left: 0!important;
|
|
41
|
+
list-style: none!important;
|
|
42
|
+
}
|
|
43
|
+
.DocContent .nav-tabs li
|
|
44
|
+
{
|
|
45
|
+
margin-top: 0px !important
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
.DocContent .nav-tabs.codeblock
|
|
50
|
+
{
|
|
51
|
+
border-bottom: 1px solid #1E1E1E;
|
|
52
|
+
margin-bottom: 0px
|
|
53
|
+
}
|
|
54
|
+
.DocContent .nav-tabs.codeblock .nav-link.active
|
|
55
|
+
{
|
|
56
|
+
background-color: #1E1E1E;
|
|
57
|
+
color: #fff;
|
|
58
|
+
border-color: #1E1E1E;
|
|
59
|
+
}
|
|
60
|
+
.DocContent .nav-tabs.codeblock .nav-link:hover
|
|
61
|
+
{
|
|
62
|
+
border-bottom-color: #1E1E1E;
|
|
63
|
+
}
|
|
64
|
+
/* eof nav tabs in doc content */
|
|
65
|
+
|
|
66
|
+
|
|
37
67
|
|
|
38
68
|
|
|
39
69
|
@media (min-width: 1000px) {
|
|
@@ -68,13 +98,13 @@
|
|
|
68
98
|
/* LAYOUT MODS */
|
|
69
99
|
|
|
70
100
|
/* table-list*/
|
|
71
|
-
.DocContent.
|
|
101
|
+
.DocContent.article-wide .injected-document-content
|
|
72
102
|
{
|
|
73
103
|
/* take up max width - overrides max-width set in [.DocContent .injected-document-content] */
|
|
74
104
|
max-width:100%;
|
|
75
105
|
}
|
|
76
106
|
|
|
77
|
-
.DocContent.
|
|
107
|
+
.DocContent.article-wide .injected-document-content table
|
|
78
108
|
{
|
|
79
109
|
/* make all tables 100% */
|
|
80
110
|
width:100%;
|
package/ui/js/doc.hornbill.js
CHANGED
|
@@ -267,6 +267,44 @@ function loadContentUrl(linkRef,fromPageRefresh,fromPopState)
|
|
|
267
267
|
generateTableOfContentsFromDoc();
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
//-- find any <tabs> and andd a bootstrap tab item strip
|
|
271
|
+
$("#DocContent").find('tabs').each((idx,el) => {
|
|
272
|
+
let tabClass = el.getAttribute("tabstyle");
|
|
273
|
+
let tabMarkup = "<ul class='nav nav-tabs'>";
|
|
274
|
+
//-- for each tab we need to create a tab link
|
|
275
|
+
$(el).find("tab").each((idx,aTab) => {
|
|
276
|
+
|
|
277
|
+
let activeClass=(idx===0)?" active":"";
|
|
278
|
+
tabMarkup += `<li class='nav-item c-pointer' contentidx='${idx}'><span class='nav-link${activeClass}'>${aTab.getAttribute("name")}</span></li>`;
|
|
279
|
+
|
|
280
|
+
//-- hide the tab element if it is not the active one (first)
|
|
281
|
+
if(idx>0)$(aTab).addClass("d-none");
|
|
282
|
+
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
tabMarkup += "</ul>";
|
|
286
|
+
//-- inject markup
|
|
287
|
+
$(el).prepend(tabMarkup).find(".nav.nav-tabs").addClass(tabClass);
|
|
288
|
+
|
|
289
|
+
//-- add event handler for switching tab items
|
|
290
|
+
$(el).find("li").off("click").on("click",function()
|
|
291
|
+
{
|
|
292
|
+
let contentIdx = this.getAttribute('contentidx');
|
|
293
|
+
let tabsContainer = $(this).closest("tabs").eq(0);
|
|
294
|
+
let tabs= tabsContainer.find("tab");
|
|
295
|
+
|
|
296
|
+
//-- hide other tab content and show this tabs content
|
|
297
|
+
tabs.addClass("d-none");
|
|
298
|
+
tabs.eq(contentIdx-0).removeClass("d-none");
|
|
299
|
+
|
|
300
|
+
//-- set clicked tab item to active
|
|
301
|
+
tabsContainer.find(".nav-link").removeClass("active");
|
|
302
|
+
$(this).find(".nav-link").addClass("active");
|
|
303
|
+
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
|
|
270
308
|
//-- do any code highlighting
|
|
271
309
|
document.querySelectorAll('pre code').forEach((el) => {
|
|
272
310
|
hljs.highlightBlock(el);
|