hdoc-tools 0.8.15 → 0.8.16

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.
Files changed (3) hide show
  1. package/hdoc-build.js +16 -9
  2. package/hdoc.js +1 -1
  3. package/package.json +1 -1
package/hdoc-build.js CHANGED
@@ -261,9 +261,6 @@
261
261
  }
262
262
  }
263
263
 
264
- // Remove the first <h1>title</h1> from the HTML as we'll ass that in the document header
265
- html_txt = html_txt.replace(/(<h1.*?>)\s*.*\s*(.*<\/h1>)/, '');
266
-
267
264
  // Does frontmatter tag contain a reading-time property
268
265
  if (!fm_contains_reading_time) {
269
266
  const read_time_mins = hdoc.get_html_read_time(html_txt);
@@ -275,9 +272,13 @@
275
272
  }
276
273
 
277
274
  // Get contributor data from Github, if exists
278
- if (hdocbook_config.publicSource && hdocbook_config.publicSource !== '') {
275
+ if (hdocbook_config.publicSource && hdocbook_config.publicSource !== '' && hdocbook_config.publicSource.includes('github.com/Hornbill-Docs')) {
276
+ // Remove the first <h1>title</h1> from the HTML as we'll add that in the document header
277
+ html_txt = html_txt.replace(/(<h1.*?>)\s*.*\s*(.*<\/h1>)/, '');
278
+
279
279
  const github_paths = hdoc.get_github_api_path(hdocbook_config.publicSource, file_path.relativePath);
280
280
  const contributors = hdoc.get_github_contributors(github_paths.api_path, git_token);
281
+
281
282
  if (!contributors.success) {
282
283
  console.log(`Error retrieving contributors from Github: ${contributors.error}`);
283
284
  } else {
@@ -305,11 +306,9 @@
305
306
  }
306
307
  }
307
308
 
308
- // Build doc header from template and frontmatter tags
309
- const doc_header = process_doc_header(fm_headers, file_path.relativePath);
310
-
309
+
311
310
  // Add frontmatter tags as comment to front of HTML
312
-
311
+
313
312
  let fm_header = '<!--[[FRONTMATTER\n';
314
313
  if (fm_headers.length > 0) {
315
314
  for (let i = 0; i < fm_headers.length; i++) {
@@ -317,8 +316,16 @@
317
316
  }
318
317
  }
319
318
  fm_header += ']]-->';
319
+
320
+ if (hdocbook_config.publicSource.includes('github.com/Hornbill-Docs')) {
321
+ // Build doc header from template and frontmatter tags
322
+ const doc_header = process_doc_header(fm_headers, file_path.relativePath);
323
+ html_txt = `${fm_header}\n${doc_header}\n${html_txt}`;
324
+ } else {
325
+ html_txt = `${fm_header}\n${html_txt}`;
326
+ }
320
327
 
321
- html_txt = `${fm_header}\n${doc_header}\n${html_txt}`;
328
+
322
329
 
323
330
  // Save HTML into HTML file
324
331
  const target_file = file_path.path.replace(path.extname(file_path.path), '.html');
package/hdoc.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  (function () {
4
4
  'use strict';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {