hdoc-tools 0.9.37 → 0.9.39
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-validate.js +13 -10
- package/package.json +1 -1
package/hdoc-validate.js
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
dree = require('dree'),
|
7
7
|
fs = require('fs'),
|
8
8
|
path = require('path'),
|
9
|
+
https = require('https'),
|
9
10
|
hdoc = require(path.join(__dirname, 'hdoc-module.js')),
|
10
11
|
translator = require('american-british-english-translator'),
|
11
12
|
{ trueCasePathSync } = require('true-case-path');
|
@@ -14,7 +15,10 @@
|
|
14
15
|
british: true,
|
15
16
|
spelling: true
|
16
17
|
},
|
17
|
-
regex_nav_paths = /[a-z0-9-\/]+/g
|
18
|
+
regex_nav_paths = /[a-z0-9-\/]+/g,
|
19
|
+
agent = new https.Agent({
|
20
|
+
rejectUnauthorized: false
|
21
|
+
});
|
18
22
|
|
19
23
|
let errors = {},
|
20
24
|
messages = {},
|
@@ -48,6 +52,7 @@
|
|
48
52
|
}
|
49
53
|
}
|
50
54
|
}
|
55
|
+
return;
|
51
56
|
};
|
52
57
|
|
53
58
|
const checkNavigation = async function (source_path, flat_nav) {
|
@@ -373,19 +378,19 @@
|
|
373
378
|
}
|
374
379
|
}
|
375
380
|
|
381
|
+
|
376
382
|
// Do spellchecking on markdown files
|
377
383
|
let md_files_spellchecked = {};
|
378
384
|
let mdPromiseArray = [];
|
379
385
|
for (let i = 0; i < md_to_validate.length; i++) {
|
386
|
+
errors[md_to_validate[i].relativePath] = [];
|
387
|
+
messages[md_to_validate[i].relativePath] = [];
|
388
|
+
warnings[md_to_validate[i].relativePath] = [];
|
380
389
|
mdPromiseArray.push(md_to_validate[i]);
|
381
390
|
}
|
382
391
|
await Promise.all(mdPromiseArray.map(async (file) => {
|
383
392
|
//await transform_markdown_and_save_html(file);
|
384
393
|
// Initiate maps for errors and verbose messages for markdown file
|
385
|
-
errors[file.relativePath] = [];
|
386
|
-
messages[file.relativePath] = [];
|
387
|
-
warnings[file.relativePath] = [];
|
388
|
-
|
389
394
|
await spellcheckContent(file, exclude_spellcheck);
|
390
395
|
md_files_spellchecked[file.relativePath.replace('.' + file.extension, '')] = true;
|
391
396
|
}));
|
@@ -394,14 +399,12 @@
|
|
394
399
|
let listContent = '';
|
395
400
|
let htmlPromiseArray = [];
|
396
401
|
for (let i = 0; i < html_to_validate.length; i++) {
|
402
|
+
errors[html_to_validate[i].relativePath] = [];
|
403
|
+
messages[html_to_validate[i].relativePath] = [];
|
404
|
+
warnings[html_to_validate[i].relativePath] = [];
|
397
405
|
htmlPromiseArray.push(html_to_validate[i]);
|
398
406
|
}
|
399
407
|
await Promise.all(mdPromiseArray.map(async (file) => {
|
400
|
-
// Initiate maps for errors and verbose messages for HTML file
|
401
|
-
errors[file.relativePath] = [];
|
402
|
-
messages[file.relativePath] = [];
|
403
|
-
warnings[file.relativePath] = [];
|
404
|
-
|
405
408
|
// Check for British spellings in static HTML content
|
406
409
|
if (!md_files_spellchecked[file.relativePath.replace('.' + file.extension, '')]) {
|
407
410
|
await spellcheckContent(file, exclude_spellcheck);
|