spec-up-t 1.1.43 → 1.1.44
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 +2 -4
- package/package.json +1 -1
- package/src/prepare-tref.js +2 -29
package/index.js
CHANGED
|
@@ -35,8 +35,7 @@ module.exports = async function (options = {}) {
|
|
|
35
35
|
|
|
36
36
|
const { fixMarkdownFiles } = require('./src/fix-markdown-files.js');
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
// const { prepareTref } = require('./src/prepare-tref.js');
|
|
38
|
+
const { prepareTref } = require('./src/prepare-tref.js');
|
|
40
39
|
|
|
41
40
|
let template = fs.readFileSync(path.join(modulePath, 'templates/template.html'), 'utf8');
|
|
42
41
|
let assets = fs.readJsonSync(modulePath + '/src/asset-map.json');
|
|
@@ -57,8 +56,7 @@ module.exports = async function (options = {}) {
|
|
|
57
56
|
}
|
|
58
57
|
];
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
// prepareTref(path.join(config.specs[0].spec_directory, config.specs[0].spec_terms_directory));
|
|
59
|
+
prepareTref(path.join(config.specs[0].spec_directory, config.specs[0].spec_terms_directory));
|
|
62
60
|
|
|
63
61
|
// Synchronously process markdown files
|
|
64
62
|
fixMarkdownFiles(path.join(config.specs[0].spec_directory, config.specs[0].spec_terms_directory));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.44",
|
|
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": {
|
package/src/prepare-tref.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file prepare-tref.js
|
|
3
|
-
* @description This module provides functionality to process markdown files in a directory recursively,
|
|
4
|
-
* searching for specific `[[tref:]]` references, and replacing them with detailed information
|
|
5
|
-
* fetched from a local JSON file (`xtrefs-data.json`). The information includes metadata such as
|
|
6
|
-
* owner, repository, commit hash, and content. If no matching reference is found, a placeholder
|
|
7
|
-
* message is written to the file.
|
|
8
|
-
*
|
|
9
|
-
* The module includes:
|
|
10
|
-
* - A helper function `getLocalXTrefContent` to retrieve reference data from the JSON file.
|
|
11
|
-
* - A main function `prepareTref` to process directories and markdown files, replacing tref references.
|
|
12
|
-
*
|
|
13
|
-
* This is useful for dynamically enriching markdown documentation with external reference details.
|
|
14
|
-
*
|
|
15
|
-
* @requires fs - Node.js file system module for reading and writing files.
|
|
16
|
-
* @requires path - Node.js path module for handling file paths.
|
|
17
|
-
* @requires dedent - A utility for removing indentation from multi-line strings.
|
|
18
|
-
*
|
|
19
|
-
* @module prepareTref
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
1
|
const fs = require('fs');
|
|
23
2
|
const path = require('path');
|
|
24
3
|
const dedent = require('dedent');
|
|
@@ -68,7 +47,8 @@ function prepareTref(directory) {
|
|
|
68
47
|
|
|
69
48
|
// Variable to store content after the span or tref line
|
|
70
49
|
let contentAfterSpan = '';
|
|
71
|
-
|
|
50
|
+
|
|
51
|
+
const spanMarker = '- - -';
|
|
72
52
|
const spanIndex = data.indexOf(spanMarker);
|
|
73
53
|
|
|
74
54
|
if (spanIndex !== -1) {
|
|
@@ -101,16 +81,9 @@ function prepareTref(directory) {
|
|
|
101
81
|
|
|
102
82
|
const readyForWrite = dedent`
|
|
103
83
|
${match[0]}
|
|
104
|
-
| Property | Value |
|
|
105
|
-
| -------- | ----- |
|
|
106
|
-
| Owner |  ${localXTrefContent.owner} |
|
|
107
|
-
| Repo | [${localXTrefContent.repo}](${localXTrefContent.repoUrl}) |
|
|
108
|
-
| Commit hash | ${localXTrefContent.commitHash} |
|
|
109
84
|
|
|
110
|
-
${localXTrefContent.content}
|
|
111
85
|
${spanMarker}
|
|
112
86
|
|
|
113
|
-
${contentAfterSpan}
|
|
114
87
|
|
|
115
88
|
`;
|
|
116
89
|
|