hdoc-tools 0.14.0 → 0.14.2

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-db.js CHANGED
@@ -117,19 +117,25 @@
117
117
  await Promise.all(indexPromises.map(async (file) => {
118
118
  let index_path_name = file.relative_path.replace('\\', '/');
119
119
  index_path_name = '/' + index_path_name.replace(path.extname(file.relative_path), '');
120
- const index_vals = [
121
- index_path_name,
122
- doc_id,
123
- book_config.audience.join(','),
124
- book_config.tags.join(','),
125
- file.index_html.fm_props.title,
126
- file.index_html.text,
127
- file.index_html.preview,
128
- book_config.productFamily,
129
- file.md5,
130
- file.lastmod
131
- ];
132
- const index_response = hdoc_index.insert_record(db, 'hdoc_index', db_schema.hdoc_index, index_vals);
120
+ let index_response = {
121
+ success: true,
122
+ row_id: 0
123
+ };
124
+ if (!file.inline) {
125
+ const index_vals = [
126
+ index_path_name,
127
+ doc_id,
128
+ book_config.audience.join(','),
129
+ book_config.tags.join(','),
130
+ file.index_html.fm_props.title,
131
+ file.index_html.text,
132
+ file.index_html.preview,
133
+ book_config.productFamily,
134
+ file.md5,
135
+ file.lastmod
136
+ ];
137
+ index_response = hdoc_index.insert_record(db, 'hdoc_index', db_schema.hdoc_index, index_vals);
138
+ }
133
139
  if (!index_response.success) {
134
140
  console.log(`Index record creation failed - ${doc_id}/${file.index_html.fm_props.title}: ${index_response.error}`);
135
141
  } else {
package/hdoc-build.js CHANGED
@@ -275,8 +275,10 @@
275
275
  contributors: contribs,
276
276
  pdf_size: pdf_size,
277
277
  md5: file_path.hash,
278
- lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod
278
+ lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod,
279
+ inline: inline_content
279
280
  });
281
+
280
282
  // Save HTML into HTML file
281
283
  try {
282
284
  fs.writeFileSync(file_path.path, html_txt);
@@ -508,15 +510,15 @@
508
510
  console.log('Error writing:', target_file, '\n', err);
509
511
  }
510
512
 
511
- const index_details = hdoc_index.transform_html_for_index(html_txt);
512
513
  index_records.push({
513
514
  relative_path: relative_path,
514
- index_html: index_details,
515
+ index_html: hdoc_index.transform_html_for_index(html_txt),
515
516
  metadata: metadata,
516
517
  contributors: contribs,
517
518
  pdf_size: pdf_size,
518
519
  md5: file_path.hash,
519
- lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod
520
+ lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod,
521
+ inline: inline_content
520
522
  });
521
523
 
522
524
  // Add MD file to delete queue
package/hdoc-serve.js CHANGED
@@ -242,7 +242,6 @@
242
242
  send_file(req, res, file_path);
243
243
  return true;
244
244
  }
245
-
246
245
  if (fs.existsSync(file_path.replace('.html', '.md'))) {
247
246
  if (transform_markdown_and_send_html(req, res, file_path.replace('.html', '.md'))) {
248
247
  return;
@@ -278,6 +277,14 @@
278
277
  res.setHeader('Content-Type', 'text/html');
279
278
  send_content_file(req, res, path.join(file_path + '/index.html'));
280
279
  return;
280
+ } else if (fs.existsSync(path.join(file_path + '.html'))) {
281
+ res.setHeader('Content-Type', 'text/html');
282
+ send_content_file(req, res, path.join(file_path + '.html'));
283
+ return;
284
+ } else if (fs.existsSync(path.join(file_path + '.htm'))) {
285
+ res.setHeader('Content-Type', 'text/html');
286
+ send_content_file(req, res, path.join(file_path + '.htm'));
287
+ return;
281
288
  }
282
289
  } else if (fs.existsSync(file_path)) {
283
290
  send_file(req, res, file_path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {