hdoc-tools 0.9.50 → 0.9.52

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Hornbill Docs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/hdoc-build.js CHANGED
@@ -526,7 +526,8 @@
526
526
  let bc_tags = '\n';
527
527
  if (bc_for_path) {
528
528
  for (let i = 0; i < bc_for_path.length - 1; i++) {
529
- bc_tags += `\t\t\t\t<li class="mt-0 nav-bar-item"><a href="${bc_for_path[i].link}" class="ps-0 pe-0 text-decoration-none">${bc_for_path[i].text}</a></li>\n`;
529
+ const bc_link = bc_for_path[i].link.startsWith('/') ? bc_for_path[i].link : `/${bc_for_path[i].link}`;
530
+ bc_tags += `\t\t\t\t<li class="mt-0 nav-bar-item"><a href="${bc_link}" class="ps-0 pe-0 text-decoration-none">${bc_for_path[i].text}</a></li>\n`;
530
531
  }
531
532
  } else {
532
533
  if (verbose) {
package/hdoc-validate.js CHANGED
@@ -123,7 +123,6 @@
123
123
  }
124
124
 
125
125
  // Validate display names/bookmarks
126
- console.log(key)
127
126
  for (let i = 0; i < flat_nav[key].length; i++) {
128
127
  if (flat_nav[key][i].link === key) {
129
128
  const translate_output = translator.translate(flat_nav[key][i].text, spellcheck_options);
@@ -156,10 +155,15 @@
156
155
  if (!valid_url) {
157
156
  // Could be a relative path, check
158
157
  if (links[i].startsWith('/')) {
159
- const link_root = links[i].split('/')[0];
158
+ let link_root = links[i].split('/');
159
+ link_root = link_root[0] !== '' ? link_root[0] : link_root[1];
160
160
  if (link_root !== hdocbook_config.docId) continue;
161
+ isRelativePath(source_path, htmlFile, links[i]);
162
+ } else if (links[i].startsWith('#')) {
163
+ //Anchor - do nothing
164
+ } else {
165
+ errors[htmlFile.relativePath].push(`Root relative links should start with a forward-slash: ${links[i]}`);
161
166
  }
162
- isRelativePath(source_path, htmlFile, links[i]);
163
167
  } else {
164
168
  messages[htmlFile.relativePath].push(`Link is a properly formatted external URL: ${links[i]}`);
165
169
 
@@ -418,7 +422,7 @@
418
422
  warnings[html_to_validate[i].relativePath] = [];
419
423
  htmlPromiseArray.push(html_to_validate[i]);
420
424
  }
421
- await Promise.all(mdPromiseArray.map(async (file) => {
425
+ await Promise.all(htmlPromiseArray.map(async (file) => {
422
426
  // Check for British spellings in static HTML content
423
427
  if (!md_files_spellchecked[file.relativePath.replace('.' + file.extension, '')]) {
424
428
  const exclusions = await spellcheckContent(file, exclude_spellcheck);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.9.50",
3
+ "version": "0.9.52",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {