hdoc-tools 0.17.7 → 0.17.9
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 +15 -3
- package/hdoc-module.js +12 -12
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
@@ -274,8 +274,13 @@
|
|
274
274
|
else
|
275
275
|
html_txt = `${fm_header_content}\n${doc_header}\n${html_txt}`;
|
276
276
|
|
277
|
+
let relative_path = file_path.relativePath;
|
278
|
+
if (!bc[relative_path.replace('.html', '')] && bc[relative_path.replace('/index.html', '')]) {
|
279
|
+
relative_path = relative_path.replace('/index.html', '');
|
280
|
+
}
|
281
|
+
|
277
282
|
index_records.push({
|
278
|
-
relative_path:
|
283
|
+
relative_path: relative_path,
|
279
284
|
index_html: hdoc_index.transform_html_for_index(html_txt),
|
280
285
|
metadata: metadata,
|
281
286
|
contributors: contribs,
|
@@ -518,13 +523,17 @@
|
|
518
523
|
|
519
524
|
// Save HTML into HTML file
|
520
525
|
const target_file = file_path.path.replace(path.extname(file_path.path), '.html');
|
521
|
-
|
526
|
+
let relative_path = file_path.relativePath.replace(path.extname(file_path.path), '.html');
|
522
527
|
try {
|
523
528
|
fs.writeFileSync(target_file, html_txt);
|
524
529
|
} catch (err) {
|
525
530
|
console.log('Error writing:', target_file, '\n', err);
|
526
531
|
}
|
527
532
|
|
533
|
+
if (!bc[relative_path.replace('.html', '')] && bc[relative_path.replace('/index.html', '')]) {
|
534
|
+
relative_path = relative_path.replace('/index.html', '');
|
535
|
+
}
|
536
|
+
|
528
537
|
index_records.push({
|
529
538
|
relative_path: relative_path,
|
530
539
|
index_html: hdoc_index.transform_html_for_index(html_txt),
|
@@ -612,7 +621,10 @@
|
|
612
621
|
wip_doc_header = wip_doc_header.replaceAll('{{edit-url}}', fm_headers[i].value);
|
613
622
|
break;
|
614
623
|
case 'last-commit':
|
615
|
-
|
624
|
+
let last_commit_date = fm_headers[i].value;
|
625
|
+
if (last_commit_date !== 'No Commit Date Available') {
|
626
|
+
last_commit_date = new Date(fm_headers[i].value).toDateString();
|
627
|
+
}
|
616
628
|
wip_doc_header = wip_doc_header.replaceAll('{{last-update}}', last_commit_date);
|
617
629
|
break;
|
618
630
|
}
|
package/hdoc-module.js
CHANGED
@@ -290,7 +290,7 @@
|
|
290
290
|
}
|
291
291
|
} catch (err) {
|
292
292
|
if (err.response) {
|
293
|
-
if (err.response.status !== 403) {
|
293
|
+
if (err.response.status !== 403 && err.response.status !== 401) {
|
294
294
|
response.error = err;
|
295
295
|
return response;
|
296
296
|
} else {
|
@@ -351,22 +351,22 @@
|
|
351
351
|
response.success = true;
|
352
352
|
let commits = github_response.data;
|
353
353
|
commits.forEach(function (commit) {
|
354
|
-
if (commit.
|
355
|
-
if (!contributors[commit.
|
354
|
+
if (commit.type && commit.type.toLowerCase() === 'user' && commit.login.toLowerCase() !== 'web-flow') {
|
355
|
+
if (!contributors[commit.id]) {
|
356
356
|
response.contributor_count++;
|
357
|
-
contributors[commit.
|
358
|
-
login: commit.
|
359
|
-
avatar_url: commit.
|
360
|
-
html_url: commit.
|
361
|
-
name: commit.commit.
|
357
|
+
contributors[commit.id] = {
|
358
|
+
login: commit.login,
|
359
|
+
avatar_url: commit.avatar_url,
|
360
|
+
html_url: commit.html_url,
|
361
|
+
name: commit.name ? commit.name : commit.login
|
362
362
|
};
|
363
363
|
}
|
364
|
-
if (response.last_commit_date !== '') {
|
365
|
-
const new_commit_date = new Date(commit.
|
364
|
+
if (response.last_commit_date !== '' && response.last_commit_date !== 'No Commit Date Available') {
|
365
|
+
const new_commit_date = new Date(commit.date);
|
366
366
|
const exist_commit_date = new Date(response.last_commit_date);
|
367
|
-
if (new_commit_date > exist_commit_date) response.last_commit_date = commit.
|
367
|
+
if (new_commit_date > exist_commit_date) response.last_commit_date = commit.date;
|
368
368
|
} else {
|
369
|
-
response.last_commit_date = commit.commit.
|
369
|
+
response.last_commit_date = commit.date ? commit.date : 'No Commit Date Available';
|
370
370
|
}
|
371
371
|
}
|
372
372
|
});
|