spec-up-t 1.2.4 → 1.2.6
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/assets/compiled/body.js +11 -8
- package/assets/compiled/head.css +7 -4
- package/assets/css/add-bootstrap-classes-to-images.css +34 -0
- package/assets/css/collapse-definitions.css +41 -0
- package/assets/css/create-pdf.css +339 -0
- package/assets/css/horizontal-scroll-hint.css +6 -0
- package/assets/css/image-full-size.css +40 -0
- package/assets/css/index.css +5 -0
- package/assets/css/search.css +8 -8
- package/assets/css/terms-and-definitions.css +3 -3
- package/assets/js/add-bootstrap-classes-to-images.js +95 -0
- package/assets/js/collapse-definitions.js +259 -34
- package/assets/js/collapse-meta-info.js +37 -10
- package/assets/js/collapsibleMenu.js +0 -24
- package/assets/js/create-alphabet-index.js +11 -2
- package/assets/js/create-term-filter.js +47 -17
- package/assets/js/hide-show-utility-container.js +16 -0
- package/assets/js/horizontal-scroll-hint.js +2 -2
- package/assets/js/image-full-size.js +74 -0
- package/assets/js/insert-trefs.js +135 -49
- package/assets/js/search.js +46 -20
- package/{src → config}/asset-map.json +6 -0
- package/{src/config → config}/paths.js +2 -2
- package/gulpfile.js +1 -1
- package/index.js +5 -5
- package/package.json +1 -1
- package/src/README.md +3 -3
- package/src/collect-external-references.js +2 -2
- package/src/collectExternalReferences/fetchTermsFromIndex.1.js +340 -0
- package/src/collectExternalReferences/fetchTermsFromIndex.js +1 -1
- package/src/collectExternalReferences/processXTrefsData.js +1 -1
- package/src/create-pdf.js +330 -21
- package/src/create-term-index.js +126 -22
- package/src/health-check/tref-term-checker.js +1 -1
- package/src/health-check.js +1 -1
- package/src/init.js +1 -1
- package/src/insert-term-index.js +5 -5
- package/src/install-from-boilerplate/add-scripts-keys.js +3 -1
- package/src/install-from-boilerplate/boilerplate/gitignore +1 -1
- package/src/markdown-it-extensions.js +2 -2
- package/src/utils/fetch.js +14 -14
- package/assets/css/pdf-styles.css +0 -170
package/src/insert-term-index.js
CHANGED
|
@@ -19,8 +19,8 @@ function insertTermIndex() {
|
|
|
19
19
|
const fs = require('fs-extra');
|
|
20
20
|
const path = require('path');
|
|
21
21
|
const config = fs.readJsonSync(path.join('specs.json'));
|
|
22
|
-
const terms = fs.readJsonSync(path.join('
|
|
23
|
-
const outputPathJSON = path.join('
|
|
22
|
+
const terms = fs.readJsonSync(path.join('.cache', 'term-index.json'));
|
|
23
|
+
const outputPathJSON = path.join('.cache', 'specs-generated.json');
|
|
24
24
|
let specGenerated = config;
|
|
25
25
|
let markdownPaths = specGenerated.specs[0].markdown_paths;
|
|
26
26
|
|
|
@@ -36,9 +36,9 @@ function insertTermIndex() {
|
|
|
36
36
|
// Save the updated specGenerated object back to the JSON file
|
|
37
37
|
fs.writeJsonSync(outputPathJSON, specGenerated, { spaces: 2 });
|
|
38
38
|
|
|
39
|
-
// Create directory named
|
|
40
|
-
if (!fs.existsSync('
|
|
41
|
-
fs.mkdirSync('
|
|
39
|
+
// Create directory named “.cache” in the project root if it does not yet exist
|
|
40
|
+
if (!fs.existsSync('.cache')) {
|
|
41
|
+
fs.mkdirSync('.cache');
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
fs.writeJsonSync(outputPathJSON, specGenerated, { spaces: 2 });
|
|
@@ -8,7 +8,9 @@ const path = require('path');
|
|
|
8
8
|
* @param {Object} [overwriteKeys={}] - An object specifying which scripts to overwrite if they already exist.
|
|
9
9
|
*/
|
|
10
10
|
function addScriptsKeys(scriptKeys, overwriteKeys = {}) {
|
|
11
|
-
|
|
11
|
+
// Use process.cwd() to get the current working directory where the command is run
|
|
12
|
+
const packageJsonPath = path.resolve(process.cwd(), 'package.json');
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
// Read the package.json file
|
|
14
16
|
fs.readFile(packageJsonPath, 'utf8', (err, data) => {
|
|
@@ -47,7 +47,7 @@ module.exports = function (md, templates = {}) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// Add the responsive wrapper div before the table
|
|
50
|
-
return '<div class="table-responsive">' + originalTableRender(tokens, idx, options, env, self);
|
|
50
|
+
return '<div class="table-responsive-md">' + originalTableRender(tokens, idx, options, env, self);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// Override table_close to close the wrapper div
|
|
@@ -256,7 +256,7 @@ module.exports = function (md, templates = {}) {
|
|
|
256
256
|
* @return {String} The rendered HTML output
|
|
257
257
|
*/
|
|
258
258
|
md.renderer.rules.dl_open = function (tokens, idx, options, env, self) {
|
|
259
|
-
const targetHtml = 'terminology-section-start
|
|
259
|
+
const targetHtml = 'terminology-section-start';
|
|
260
260
|
let targetIndex = findTargetIndex(tokens, targetHtml);
|
|
261
261
|
|
|
262
262
|
// Add class to the first <dl> only if it comes after the target HTML
|
package/src/utils/fetch.js
CHANGED
|
@@ -5,13 +5,13 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Fetches the
|
|
8
|
+
* Fetches the .cache/specs-generated.json file and returns it as a JavaScript object
|
|
9
9
|
* @returns {Object} The parsed contents of specs-generated.json
|
|
10
10
|
*/
|
|
11
11
|
function fetchSpecs() {
|
|
12
12
|
try {
|
|
13
|
-
// Resolve path to
|
|
14
|
-
const specsPath = path.resolve(process.cwd(), '
|
|
13
|
+
// Resolve path to .cache/specs-generated.json from the project root
|
|
14
|
+
const specsPath = path.resolve(process.cwd(), '.cache', 'specs-generated.json');
|
|
15
15
|
|
|
16
16
|
// Read the file synchronously
|
|
17
17
|
const specsContent = fs.readFileSync(specsPath, 'utf8');
|
|
@@ -21,19 +21,19 @@ function fetchSpecs() {
|
|
|
21
21
|
|
|
22
22
|
return specs;
|
|
23
23
|
} catch (error) {
|
|
24
|
-
console.error('Error fetching
|
|
24
|
+
console.error('Error fetching .cache/specs-generated.json:', error.message);
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Fetches the
|
|
30
|
+
* Fetches the .cache/xtrefs-data.json file and returns it as a JavaScript object
|
|
31
31
|
* @returns {Object} The parsed contents of xtrefs-data.json
|
|
32
32
|
*/
|
|
33
33
|
function fetchExternalTerms() {
|
|
34
34
|
try {
|
|
35
|
-
// Resolve path to
|
|
36
|
-
const xtrefsPath = path.resolve(process.cwd(), '
|
|
35
|
+
// Resolve path to .cache/xtrefs-data.json from the project root
|
|
36
|
+
const xtrefsPath = path.resolve(process.cwd(), '.cache', 'xtrefs-data.json');
|
|
37
37
|
|
|
38
38
|
// Read the file synchronously
|
|
39
39
|
const xtrefsContent = fs.readFileSync(xtrefsPath, 'utf8');
|
|
@@ -43,7 +43,7 @@ function fetchExternalTerms() {
|
|
|
43
43
|
|
|
44
44
|
return xtrefs;
|
|
45
45
|
} catch (error) {
|
|
46
|
-
console.error('Error fetching
|
|
46
|
+
console.error('Error fetching .cache/xtrefs-data.json:', error.message);
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -54,8 +54,8 @@ function fetchExternalTerms() {
|
|
|
54
54
|
*/
|
|
55
55
|
async function fetchSpecsAsync() {
|
|
56
56
|
try {
|
|
57
|
-
// Resolve path to
|
|
58
|
-
const specsPath = path.resolve(process.cwd(), '
|
|
57
|
+
// Resolve path to .cache/specs-generated.json from the project root
|
|
58
|
+
const specsPath = path.resolve(process.cwd(), '.cache', 'specs-generated.json');
|
|
59
59
|
|
|
60
60
|
// Read the file asynchronously
|
|
61
61
|
const specsContent = await fs.promises.readFile(specsPath, 'utf8');
|
|
@@ -65,7 +65,7 @@ async function fetchSpecsAsync() {
|
|
|
65
65
|
|
|
66
66
|
return specs;
|
|
67
67
|
} catch (error) {
|
|
68
|
-
console.error('Error fetching
|
|
68
|
+
console.error('Error fetching .cache/specs-generated.json:', error.message);
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -76,8 +76,8 @@ async function fetchSpecsAsync() {
|
|
|
76
76
|
*/
|
|
77
77
|
async function fetchExternalTermsAsync() {
|
|
78
78
|
try {
|
|
79
|
-
// Resolve path to
|
|
80
|
-
const xtrefsPath = path.resolve(process.cwd(), '
|
|
79
|
+
// Resolve path to .cache/xtrefs-data.json from the project root
|
|
80
|
+
const xtrefsPath = path.resolve(process.cwd(), '.cache', 'xtrefs-data.json');
|
|
81
81
|
|
|
82
82
|
// Read the file asynchronously
|
|
83
83
|
const xtrefsContent = await fs.promises.readFile(xtrefsPath, 'utf8');
|
|
@@ -87,7 +87,7 @@ async function fetchExternalTermsAsync() {
|
|
|
87
87
|
|
|
88
88
|
return xtrefs;
|
|
89
89
|
} catch (error) {
|
|
90
|
-
console.error('Error fetching
|
|
90
|
+
console.error('Error fetching .cache/xtrefs-data.json:', error.message);
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/* PDF Styling for optimized print layout */
|
|
2
|
-
|
|
3
|
-
/* Target the pdf-document class that's added during PDF generation */
|
|
4
|
-
|
|
5
|
-
/* Reset all margins and paddings */
|
|
6
|
-
.pdf-document * {
|
|
7
|
-
box-sizing: border-box !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Body and main container styling */
|
|
11
|
-
body.pdf-document {
|
|
12
|
-
max-width: 100% !important;
|
|
13
|
-
width: 100% !important;
|
|
14
|
-
margin: 0 !important;
|
|
15
|
-
padding: 0 !important;
|
|
16
|
-
overflow-x: hidden !important;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Extremely aggressive content width adjustment */
|
|
20
|
-
.pdf-document .container,
|
|
21
|
-
.pdf-document main,
|
|
22
|
-
.pdf-document section,
|
|
23
|
-
.pdf-document article,
|
|
24
|
-
.pdf-document .content,
|
|
25
|
-
.pdf-document div[class*="container"],
|
|
26
|
-
.pdf-document div[class*="col-"],
|
|
27
|
-
.pdf-document .row {
|
|
28
|
-
max-width: 95% !important;
|
|
29
|
-
width: 95% !important;
|
|
30
|
-
margin-left: auto !important;
|
|
31
|
-
margin-right: auto !important;
|
|
32
|
-
padding-left: 0 !important;
|
|
33
|
-
padding-right: 0 !important;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Override any Bootstrap container constraints */
|
|
37
|
-
.pdf-document .container,
|
|
38
|
-
.pdf-document .container-sm,
|
|
39
|
-
.pdf-document .container-md,
|
|
40
|
-
.pdf-document .container-lg,
|
|
41
|
-
.pdf-document .container-xl {
|
|
42
|
-
max-width: 95% !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* Table adjustments */
|
|
46
|
-
.pdf-document table {
|
|
47
|
-
width: 100% !important;
|
|
48
|
-
max-width: 100% !important;
|
|
49
|
-
margin-bottom: 1rem;
|
|
50
|
-
table-layout: fixed !important;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* Header styling */
|
|
54
|
-
.pdf-document .pdf-title {
|
|
55
|
-
font-size: 24pt !important;
|
|
56
|
-
margin-bottom: 0.5rem !important;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/* Images in PDF */
|
|
60
|
-
.pdf-document img {
|
|
61
|
-
max-width: 100% !important;
|
|
62
|
-
height: auto !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* Code blocks */
|
|
66
|
-
.pdf-document pre,
|
|
67
|
-
.pdf-document code {
|
|
68
|
-
white-space: pre-wrap !important;
|
|
69
|
-
word-break: break-word !important;
|
|
70
|
-
max-width: 100% !important;
|
|
71
|
-
overflow: visible !important;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* Ensure proper page breaks */
|
|
75
|
-
.pdf-document h1,
|
|
76
|
-
.pdf-document h2,
|
|
77
|
-
.pdf-document h3,
|
|
78
|
-
.pdf-document h4 {
|
|
79
|
-
page-break-after: avoid;
|
|
80
|
-
page-break-inside: avoid;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.pdf-document table,
|
|
84
|
-
.pdf-document figure {
|
|
85
|
-
page-break-inside: avoid;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* Force any fixed-position elements to static */
|
|
89
|
-
.pdf-document .fixed-top,
|
|
90
|
-
.pdf-document .fixed-bottom,
|
|
91
|
-
.pdf-document .sticky-top,
|
|
92
|
-
.pdf-document .position-fixed,
|
|
93
|
-
.pdf-document .position-sticky {
|
|
94
|
-
position: static !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Aggressively set all columns to take up more space */
|
|
98
|
-
.pdf-document .col,
|
|
99
|
-
.pdf-document [class*="col-"] {
|
|
100
|
-
flex: 0 0 100% !important;
|
|
101
|
-
max-width: 100% !important;
|
|
102
|
-
padding-left: 0 !important;
|
|
103
|
-
padding-right: 0 !important;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* ====== DEFINITION LIST STYLING FOR PDF ====== */
|
|
107
|
-
/* Remove background and borders from terms and definitions in PDF */
|
|
108
|
-
.pdf-document dl.terms-and-definitions-list>dt,
|
|
109
|
-
.pdf-document dl.terms-and-definitions-list>dd {
|
|
110
|
-
background-color: transparent !important;
|
|
111
|
-
border: none !important;
|
|
112
|
-
border-radius: 0 !important;
|
|
113
|
-
padding: 0.5rem 0 !important;
|
|
114
|
-
color: #000 !important;
|
|
115
|
-
/* Ensure good page breaks in definition lists */
|
|
116
|
-
page-break-inside: avoid !important;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/* Fix spacing between terms */
|
|
120
|
-
.pdf-document dl.terms-and-definitions-list>dt {
|
|
121
|
-
margin-top: 1em !important;
|
|
122
|
-
font-weight: bold !important;
|
|
123
|
-
page-break-after: avoid !important;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/* Hide toggle buttons in PDF output */
|
|
127
|
-
.pdf-document .meta-info-toggle-button {
|
|
128
|
-
display: none !important;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Always show meta-info content in PDF */
|
|
132
|
-
.pdf-document dl>dd.meta-info-content-wrapper,
|
|
133
|
-
.pdf-document dl>dd.collapsed.meta-info-content-wrapper {
|
|
134
|
-
display: block !important;
|
|
135
|
-
max-height: none !important;
|
|
136
|
-
height: auto !important;
|
|
137
|
-
overflow: visible !important;
|
|
138
|
-
padding: 0.5rem 0 !important;
|
|
139
|
-
margin: 0 !important;
|
|
140
|
-
line-height: normal !important;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/* Transclusion styling for PDF */
|
|
144
|
-
.pdf-document dt.transcluded-xref-term,
|
|
145
|
-
.pdf-document dd.transcluded-xref-term {
|
|
146
|
-
background: transparent !important;
|
|
147
|
-
background-color: transparent !important;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* Remove any other visual indicators that aren't needed in PDF */
|
|
151
|
-
.pdf-document dl.terms-and-definitions-list>dt::before,
|
|
152
|
-
.pdf-document dl.terms-and-definitions-list>dd::before {
|
|
153
|
-
display: none !important;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/* Ensure all definition content is visible in PDF */
|
|
157
|
-
.pdf-document dl.terms-and-definitions-list dd p {
|
|
158
|
-
padding-left: 0 !important;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/* Improve table display in definitions for PDF */
|
|
162
|
-
.pdf-document dl.terms-and-definitions-list dd table {
|
|
163
|
-
margin: 0.5em 0 !important;
|
|
164
|
-
border-collapse: collapse !important;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.pdf-document dl.terms-and-definitions-list dd table th,
|
|
168
|
-
.pdf-document dl.terms-and-definitions-list dd table td {
|
|
169
|
-
border: 0.5pt solid #888 !important;
|
|
170
|
-
}
|