spec-up-t 1.4.0 → 1.4.1-beta.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1-beta.1",
|
|
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": {
|
|
@@ -105,17 +105,15 @@ async function fetchAllTermsFromIndex(token, owner, repo, options = {}) {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!termText) {
|
|
116
|
-
termText = termSpan.textContent.trim();
|
|
108
|
+
// Extract the canonical term identifier from the term-local-original-term span.
|
|
109
|
+
// This contains the original term identifier as used in the source file naming
|
|
110
|
+
// and tref/xref references. If this span doesn't exist, skip the term entirely.
|
|
111
|
+
const originalTermSpan = dt.querySelector('span.term-local-original-term');
|
|
112
|
+
if (!originalTermSpan) {
|
|
113
|
+
return;
|
|
117
114
|
}
|
|
118
115
|
|
|
116
|
+
const termText = originalTermSpan.textContent.trim();
|
|
119
117
|
if (!termText) {
|
|
120
118
|
return;
|
|
121
119
|
}
|
|
@@ -14,7 +14,7 @@ async function processXTrefsData(allXTrefs, GITHUB_API_TOKEN, outputPathJSON, ou
|
|
|
14
14
|
|
|
15
15
|
allXTrefs.xtrefs = allXTrefs.xtrefs.filter(xtref => {
|
|
16
16
|
if (!xtref.owner || !xtref.repo || !xtref.repoUrl) {
|
|
17
|
-
Logger.
|
|
17
|
+
Logger.error(`Removing incomplete reference: ${xtref.externalSpec}, ${xtref.term}`);
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
return true;
|
package/src/utils/git-info.js
CHANGED
|
@@ -25,7 +25,7 @@ function getCurrentBranch() {
|
|
|
25
25
|
}).trim();
|
|
26
26
|
|
|
27
27
|
if (branch) {
|
|
28
|
-
Logger.info(`Current git branch: ${branch}`);
|
|
28
|
+
// This is too much info, comment out for the moment, Logger.info(`Current git branch: ${branch}`);
|
|
29
29
|
return branch;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -61,7 +61,6 @@ function getGithubRepoInfo(spec) {
|
|
|
61
61
|
const account = source.account || 'unknown';
|
|
62
62
|
const repo = source.repo || 'unknown';
|
|
63
63
|
const branch = getCurrentBranch();
|
|
64
|
-
|
|
65
64
|
const content = `${account},${repo},${branch}`;
|
|
66
65
|
Logger.info(`GitHub repo info: ${content}`);
|
|
67
66
|
return content;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file match-term.js
|
|
3
|
-
* @description Utilities for matching a specific term within a [[def: ...]] definition block.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { isLineWithDefinition } = require('../../utils/is-line-with-definition');
|
|
7
|
-
const Logger = require('../../utils/logger');
|
|
8
|
-
|
|
9
|
-
function matchTerm(text, term) {
|
|
10
|
-
if (!text || typeof text !== 'string') {
|
|
11
|
-
Logger.warn('Nothing to match for term:', term);
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const firstLine = text.split('\n')[0].trim();
|
|
16
|
-
if (!isLineWithDefinition(firstLine)) {
|
|
17
|
-
Logger.warn('String does not start with `[[def:` or end with `]]`');
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const startPos = firstLine.indexOf('[[def:') + 6;
|
|
22
|
-
const endPos = firstLine.indexOf(']]');
|
|
23
|
-
if (startPos === -1 || endPos === -1) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const relevantPart = firstLine.substring(startPos, endPos);
|
|
28
|
-
const termsArray = relevantPart.split(',').map(entry => entry.trim());
|
|
29
|
-
return termsArray.includes(term);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
matchTerm
|
|
34
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const { matchTerm } = require('./match-term');
|
|
2
|
-
|
|
3
|
-
// Tests for matching terms within definition markup
|
|
4
|
-
describe('matchTerm', () => {
|
|
5
|
-
// Test: Can the system find terms that exist in definition markup?
|
|
6
|
-
test('returns true when the term is found in a correctly formatted definition', () => {
|
|
7
|
-
const text = '[[def: term1, term2]]\nSome additional text';
|
|
8
|
-
expect(matchTerm(text, 'term1')).toBe(true);
|
|
9
|
-
expect(matchTerm(text, 'term2')).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// Test: Does the system correctly identify when a term is not present?
|
|
13
|
-
test('returns false when the term is not found in the definition', () => {
|
|
14
|
-
const text = '[[def: term1, term2]]\nSome additional text';
|
|
15
|
-
expect(matchTerm(text, 'term3')).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Test: Does the system handle invalid input gracefully?
|
|
19
|
-
test('returns false when the text is null or not a string', () => {
|
|
20
|
-
expect(matchTerm(null, 'term1')).toBe(false);
|
|
21
|
-
expect(matchTerm(123, 'term1')).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// Test: Does the system require proper definition markup format?
|
|
25
|
-
test('returns false when the first line is not a valid definition', () => {
|
|
26
|
-
const text = 'Invalid definition line\n[[def: term1, term2]]';
|
|
27
|
-
expect(matchTerm(text, 'term1')).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Test: Can the system handle whitespace variations in markup?
|
|
31
|
-
test('handles extra spaces correctly', () => {
|
|
32
|
-
const text = '[[def: term1 , term2 ]]';
|
|
33
|
-
expect(matchTerm(text, 'term1')).toBe(true);
|
|
34
|
-
expect(matchTerm(text, 'term2')).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
});
|