spec-up-t 1.1.41 → 1.1.42
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/package.json +1 -1
- package/src/prepare-tref.js +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.42",
|
|
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
|
@@ -66,12 +66,26 @@ function prepareTref(directory) {
|
|
|
66
66
|
// Split the content into lines
|
|
67
67
|
let lines = data.split('\n');
|
|
68
68
|
|
|
69
|
-
// Variable to store content after the span
|
|
69
|
+
// Variable to store content after the span or tref line
|
|
70
70
|
let contentAfterSpan = '';
|
|
71
71
|
const spanMarker = '<span style="display: none;">End of included external content. Add your optional custom content below.</span>';
|
|
72
72
|
const spanIndex = data.indexOf(spanMarker);
|
|
73
|
+
|
|
73
74
|
if (spanIndex !== -1) {
|
|
75
|
+
// If span marker exists, take content after it
|
|
74
76
|
contentAfterSpan = data.substring(spanIndex + spanMarker.length);
|
|
77
|
+
} else {
|
|
78
|
+
// If span marker doesn't exist, find the tref line and keep everything after it
|
|
79
|
+
let trefLineIndex = -1;
|
|
80
|
+
for (let i = 0; i < lines.length; i++) {
|
|
81
|
+
if (lines[i].startsWith('[[tref:')) {
|
|
82
|
+
trefLineIndex = i;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (trefLineIndex !== -1 && trefLineIndex < lines.length - 1) {
|
|
87
|
+
contentAfterSpan = lines.slice(trefLineIndex + 1).join('\n');
|
|
88
|
+
}
|
|
75
89
|
}
|
|
76
90
|
|
|
77
91
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -94,7 +108,10 @@ ${match[0]}
|
|
|
94
108
|
| Commit hash | ${localXTrefContent.commitHash} |
|
|
95
109
|
|
|
96
110
|
${localXTrefContent.content}
|
|
97
|
-
${spanMarker}
|
|
111
|
+
${spanMarker}
|
|
112
|
+
|
|
113
|
+
${contentAfterSpan}
|
|
114
|
+
|
|
98
115
|
`;
|
|
99
116
|
|
|
100
117
|
fs.writeFileSync(itemPath, readyForWrite, 'utf8');
|