spec-up-t 1.2.9 → 1.3.0
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/.github/copilot-instructions.md +2 -1
- package/assets/compiled/body.js +5 -5
- package/assets/compiled/head.css +1 -0
- package/assets/css/counter.css +104 -0
- package/assets/js/addAnchorsToTerms.js +13 -5
- package/assets/js/collapse-definitions.js +0 -3
- package/assets/js/custom-elements.js +25 -27
- package/assets/js/fix-last-dd.js +6 -3
- package/assets/js/highlight-heading-plus-sibling-nodes.js +0 -1
- package/assets/js/highlight-heading-plus-sibling-nodes.test.js +120 -0
- package/assets/js/insert-trefs.js +32 -28
- package/config/asset-map.json +1 -0
- package/index.js +33 -227
- package/package.json +4 -2
- package/sonar-project.properties +7 -0
- package/src/collect-external-references.js +22 -11
- package/src/collect-external-references.test.js +153 -2
- package/src/collectExternalReferences/fetchTermsFromIndex.js +65 -110
- package/src/collectExternalReferences/processXTrefsData.js +9 -11
- package/src/create-docx.js +332 -0
- package/src/create-pdf.js +243 -122
- package/src/fix-markdown-files.js +31 -34
- package/src/html-dom-processor.js +290 -0
- package/src/init.js +3 -0
- package/src/install-from-boilerplate/boilerplate/.github/workflows/menu.yml +51 -36
- package/src/install-from-boilerplate/boilerplate/spec/example-markup-in-markdown.md +0 -1
- package/src/install-from-boilerplate/boilerplate/spec/terms-and-definitions-intro.md +1 -5
- package/src/install-from-boilerplate/config-scripts-keys.js +4 -4
- package/src/install-from-boilerplate/menu.sh +6 -6
- package/src/markdown-it-extensions.js +54 -33
- package/src/references.js +18 -6
- package/templates/template.html +2 -0
package/src/references.js
CHANGED
|
@@ -47,25 +47,37 @@ async function fetchExternalSpecs(spec) {
|
|
|
47
47
|
try {
|
|
48
48
|
let results = await Promise.all(
|
|
49
49
|
spec.external_specs.map(s => {
|
|
50
|
-
const url = s["gh_page"];
|
|
51
|
-
return axios.get(url);
|
|
50
|
+
const url = s["gh_page"];
|
|
51
|
+
return axios.get(url).catch(error => ({ error, url }));
|
|
52
52
|
})
|
|
53
53
|
);
|
|
54
54
|
|
|
55
|
+
const failed = results.filter(r => r && r.error);
|
|
56
|
+
if (failed.length > 0) {
|
|
57
|
+
failed.forEach(f => {
|
|
58
|
+
const msg = f.error.response
|
|
59
|
+
? `HTTP ${f.error.response.status} for ${f.url}`
|
|
60
|
+
: `Network error for ${f.url}: ${f.error.message}`;
|
|
61
|
+
console.error("❌ External spec fetch failed:", msg);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Map results to objects keyed by external_spec if status is 200, otherwise null.
|
|
66
|
+
// This ensures only successful fetches are included, and failed ones are filtered out.
|
|
55
67
|
results = results
|
|
56
68
|
.map((r, index) =>
|
|
57
|
-
r.status === 200
|
|
69
|
+
r && r.status === 200
|
|
58
70
|
? { [spec.external_specs[index].external_spec]: r.data }
|
|
59
71
|
: null
|
|
60
72
|
)
|
|
61
|
-
.filter(r => r); // Remove null values
|
|
73
|
+
.filter(r => r); // Remove null values (failed fetches)
|
|
62
74
|
|
|
63
75
|
return results.map(r =>
|
|
64
76
|
createNewDLWithTerms(Object.keys(r)[0], Object.values(r)[0])
|
|
65
77
|
);
|
|
66
78
|
} catch (e) {
|
|
67
|
-
console.
|
|
68
|
-
return [];
|
|
79
|
+
console.error("❌ Unexpected error in fetchExternalSpecs:", e);
|
|
80
|
+
return [];
|
|
69
81
|
}
|
|
70
82
|
}
|
|
71
83
|
|