spec-up-t 1.1.50 → 1.1.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/index.js +6 -1
- package/package.json +1 -1
- package/src/create-external-specs-list.js +52 -0
- package/templates/template.html +3 -1
package/index.js
CHANGED
|
@@ -30,6 +30,10 @@ module.exports = async function (options = {}) {
|
|
|
30
30
|
const modulePath = findPkgDir(__dirname);
|
|
31
31
|
let config = fs.readJsonSync('./output/specs-generated.json');
|
|
32
32
|
|
|
33
|
+
const createExternalSpecsList = require('./src/create-external-specs-list.js');
|
|
34
|
+
|
|
35
|
+
const externalSpecsList = createExternalSpecsList(config);
|
|
36
|
+
|
|
33
37
|
const createVersionsIndex = require('./src/create-versions-index.js');
|
|
34
38
|
createVersionsIndex(config.specs[0].output_path);
|
|
35
39
|
|
|
@@ -307,7 +311,8 @@ module.exports = async function (options = {}) {
|
|
|
307
311
|
specLogo: spec.logo,
|
|
308
312
|
specFavicon: spec.favicon,
|
|
309
313
|
specLogoLink: spec.logo_link,
|
|
310
|
-
spec: JSON.stringify(spec)
|
|
314
|
+
spec: JSON.stringify(spec),
|
|
315
|
+
externalSpecsList: externalSpecsList,
|
|
311
316
|
});
|
|
312
317
|
|
|
313
318
|
const outputPath = path.join(spec.destination, 'index.html');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.52",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an HTML list of external specifications based on the provided configuration.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} config - The configuration object containing specification details.
|
|
5
|
+
* @param {Array<object>} config.specs - An array of specification objects.
|
|
6
|
+
* @param {Array<object>} config.specs[].external_specs - An array of external specification objects.
|
|
7
|
+
* @param {string} config.specs[].external_specs[].external_spec - The name of the external specification.
|
|
8
|
+
* @param {string} config.specs[].external_specs[].url - The URL of the external specification.
|
|
9
|
+
* @param {string} config.specs[].external_specs[].gh_page - The GitHub page of the external specification.
|
|
10
|
+
*
|
|
11
|
+
* @returns {string} An HTML string representing the list of external specifications.
|
|
12
|
+
* Returns a message indicating no specifications were found if the configuration is invalid or empty.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
module.exports = function createExternalSpecsList(config) {
|
|
16
|
+
if (!config || !config.specs || !Array.isArray(config.specs)) {
|
|
17
|
+
console.warn('❌ Invalid config format. Expected an object with a specs array.');
|
|
18
|
+
return '<p>No external specifications found.</p>';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let externalSpecs = [];
|
|
22
|
+
config.specs.forEach(spec => {
|
|
23
|
+
if (spec.external_specs && Array.isArray(spec.external_specs)) {
|
|
24
|
+
externalSpecs = externalSpecs.concat(spec.external_specs);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (externalSpecs.length === 0) {
|
|
29
|
+
return '<p>No external specifications found.</p>';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let html = '<ul class="list-group">';
|
|
33
|
+
|
|
34
|
+
externalSpecs.forEach(spec => {
|
|
35
|
+
html += `
|
|
36
|
+
<li class="list-group-item border-0 p-0 ps-3">
|
|
37
|
+
<p>
|
|
38
|
+
${spec.external_spec}:
|
|
39
|
+
<a href="${spec.url}" target="_blank" class="">
|
|
40
|
+
<i class="fa fa-link"></i> URL
|
|
41
|
+
</a>
|
|
42
|
+
<a href="${spec.gh_page}" target="_blank" class="">
|
|
43
|
+
<i class="fa fa-github"></i> GitHub Page
|
|
44
|
+
</a>
|
|
45
|
+
</p>
|
|
46
|
+
</li>
|
|
47
|
+
`;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
html += '</ul>';
|
|
51
|
+
return html;
|
|
52
|
+
};
|
package/templates/template.html
CHANGED
|
@@ -247,7 +247,9 @@
|
|
|
247
247
|
</button>
|
|
248
248
|
<!-- href added via JS -->
|
|
249
249
|
<a id="snapshotLink" class="btn btn-menu-item m-0 mb-1 border-start-0 border-end-0" href="#">Snapshots</a>
|
|
250
|
-
|
|
250
|
+
<hr>
|
|
251
|
+
<p class="ps-3 pe-3">External specifications:</p>
|
|
252
|
+
${externalSpecsList}
|
|
251
253
|
</div>
|
|
252
254
|
</div>
|
|
253
255
|
|