spec-up-t 1.2.0 → 1.2.2
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 +7 -5
- package/assets/compiled/head.css +5 -6
- package/assets/css/backToTop.css +1 -0
- package/assets/css/header-navbar.css +1 -1
- package/assets/css/pdf-download.css +27 -12
- package/assets/css/pdf-styles.css +174 -0
- package/assets/css/sidebar-toc.css +109 -2
- package/assets/css/terms-and-definitions.css +65 -47
- package/assets/js/collapse-meta-info.js +5 -1
- package/assets/js/collapsibleMenu.js +133 -0
- package/assets/js/edit-term-buttons.js +19 -4
- package/assets/js/fix-last-dd.js +44 -0
- package/assets/js/highlightMenuItems.js +5 -0
- package/assets/js/insert-trefs.js +2 -1
- package/assets/js/pdf-download.js +18 -5
- package/index.js +100 -54
- package/package.json +1 -1
- package/src/asset-map.json +2 -2
- package/src/create-pdf.js +141 -390
- package/templates/template.html +3 -0
- package/assets/css/collapse-meta-info.css +0 -40
- package/assets/css/terms-and-definitions.1.css +0 -223
- package/assets/js/index.1.js +0 -137
- package/assets/js/insert-xrefs.1.js +0 -372
- package/index.new.js +0 -662
|
@@ -59,7 +59,6 @@ dl.terms-and-definitions-list > dt {
|
|
|
59
59
|
border: 1px solid var(--card-border);
|
|
60
60
|
padding: 0.5rem 1.25rem; /* Increased vertical padding for better readability */
|
|
61
61
|
border-radius: 0.375rem 0.375rem 0 0;
|
|
62
|
-
box-shadow: 0 0.125rem 0.25rem var(--card-shadow);
|
|
63
62
|
color: var(--card-text);
|
|
64
63
|
position: relative; /* Position relative for stacking */
|
|
65
64
|
line-height: 1.5; /* Improve line spacing */
|
|
@@ -83,32 +82,21 @@ dl.terms-and-definitions-list > dt:hover {
|
|
|
83
82
|
transition: background-color 0.2s ease-in-out;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
/*
|
|
87
|
-
dl.terms-and-definitions-list > dt::before {
|
|
88
|
-
content: "";
|
|
89
|
-
width: 4px;
|
|
90
|
-
height: 70%;
|
|
91
|
-
background-color: #73c2df;
|
|
92
|
-
position: absolute;
|
|
93
|
-
left: 0;
|
|
94
|
-
border-radius: 0 2px 2px 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Definition styling (dd) - using the original simpler styling */
|
|
85
|
+
/* Definition styling (dd) */
|
|
98
86
|
dl.terms-and-definitions-list > dd {
|
|
99
87
|
margin: 0;
|
|
100
88
|
background-color: var(--card-bg);
|
|
101
89
|
border: 1px solid var(--card-border);
|
|
102
90
|
border-top: none;
|
|
103
|
-
padding: 0.
|
|
91
|
+
padding: 0.5rem 2rem;
|
|
104
92
|
color: var(--card-text);
|
|
105
93
|
width: 100%;
|
|
106
94
|
position: relative;
|
|
107
95
|
}
|
|
108
96
|
|
|
109
|
-
/* Style paragraphs inside dd
|
|
97
|
+
/* Style paragraphs inside dd */
|
|
110
98
|
dl.terms-and-definitions-list dd p {
|
|
111
|
-
margin: 0;
|
|
99
|
+
margin: 0;
|
|
112
100
|
color: var(--card-text);
|
|
113
101
|
padding-left: 0.5rem;
|
|
114
102
|
}
|
|
@@ -120,7 +108,7 @@ dl.terms-and-definitions-list > dd::before {
|
|
|
120
108
|
|
|
121
109
|
/* Improve table styling in definitions */
|
|
122
110
|
dl.terms-and-definitions-list dd table {
|
|
123
|
-
margin:
|
|
111
|
+
margin: 0.5em 0;
|
|
124
112
|
width: 100%;
|
|
125
113
|
border-collapse: collapse;
|
|
126
114
|
}
|
|
@@ -135,6 +123,55 @@ dl.terms-and-definitions-list dd table th {
|
|
|
135
123
|
background-color: #f5f5f5;
|
|
136
124
|
}
|
|
137
125
|
|
|
126
|
+
/*
|
|
127
|
+
Make the meta-info tables collapsible
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/* Wrapper for meta info content */
|
|
131
|
+
dl>dd:has(table).meta-info-content-wrapper {
|
|
132
|
+
display: block;
|
|
133
|
+
font-size: 0.7em;
|
|
134
|
+
position: relative;
|
|
135
|
+
max-height: none;
|
|
136
|
+
height: auto;
|
|
137
|
+
overflow: visible;
|
|
138
|
+
transition: all 0.3s ease-out;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
dl>dd:has(table).meta-info-content-wrapper td,
|
|
142
|
+
dl>dd:has(table).meta-info-content-wrapper th {
|
|
143
|
+
padding: 0.3em;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Collapsed state for meta info content */
|
|
147
|
+
dl>dd:has(table).collapsed.meta-info-content-wrapper {
|
|
148
|
+
max-height: 0;
|
|
149
|
+
height: 0;
|
|
150
|
+
padding-top: 0;
|
|
151
|
+
padding-bottom: 0;
|
|
152
|
+
margin-top: 0;
|
|
153
|
+
margin-bottom: 0;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
transition: all 0.3s ease-out;
|
|
156
|
+
line-height: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* The inner content wrapper to ensure proper spacing */
|
|
160
|
+
dl>dd:has(table).meta-info-content-wrapper>div {
|
|
161
|
+
display: block;
|
|
162
|
+
padding: inherit;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Meta info toggle button */
|
|
166
|
+
.meta-info-toggle-button {
|
|
167
|
+
position: relative;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/*
|
|
172
|
+
END Make the meta-info tables collapsible
|
|
173
|
+
*/
|
|
174
|
+
|
|
138
175
|
/* Borders and spacing between elements */
|
|
139
176
|
dl.terms-and-definitions-list dt + dd {
|
|
140
177
|
border-bottom: none;
|
|
@@ -146,7 +183,7 @@ dl.terms-and-definitions-list dd + dd {
|
|
|
146
183
|
}
|
|
147
184
|
|
|
148
185
|
dl.terms-and-definitions-list dd + dt {
|
|
149
|
-
margin-top:
|
|
186
|
+
margin-top: 1rem;
|
|
150
187
|
}
|
|
151
188
|
|
|
152
189
|
/* Last definition in a group */
|
|
@@ -164,6 +201,10 @@ html.dense-info dl.terms-and-definitions-list > dt {
|
|
|
164
201
|
font-size: inherit;
|
|
165
202
|
}
|
|
166
203
|
|
|
204
|
+
html.dense-info dl.terms-and-definitions-list dd+dt {
|
|
205
|
+
margin-top: 0.3rem;
|
|
206
|
+
}
|
|
207
|
+
|
|
167
208
|
html.dense-info dl.terms-and-definitions-list > dt::before {
|
|
168
209
|
display: none; /* Remove the blue indicator bar */
|
|
169
210
|
}
|
|
@@ -172,11 +213,6 @@ html.dense-info dl.terms-and-definitions-list > dt > span {
|
|
|
172
213
|
margin-right: 0; /* Remove spacing for term text */
|
|
173
214
|
}
|
|
174
215
|
|
|
175
|
-
/* No need to change dd styling in dense-info mode since it's already using the original styling */
|
|
176
|
-
html.dense-info dl.terms-and-definitions-list > dd {
|
|
177
|
-
padding: 0.75rem 1.25rem;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
216
|
/* ====== TRANSCLUSIONS STYLING ====== */
|
|
181
217
|
/* Base transclusion styles */
|
|
182
218
|
.transcluded-xref-term {
|
|
@@ -203,28 +239,19 @@ dd.transcluded-xref-term {
|
|
|
203
239
|
.transclusion-heading {
|
|
204
240
|
font-size: 1.3em;
|
|
205
241
|
font-weight: bold;
|
|
206
|
-
margin:
|
|
242
|
+
margin: 0.2em 0 0.2em;
|
|
207
243
|
}
|
|
208
244
|
|
|
209
245
|
/* Embedded transclusions in definition lists */
|
|
210
246
|
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded {
|
|
211
247
|
position: relative;
|
|
212
248
|
padding-left: 2.5rem;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded::before {
|
|
216
|
-
content: "";
|
|
217
|
-
position: absolute;
|
|
218
|
-
left: 0;
|
|
219
|
-
top: 0;
|
|
220
|
-
bottom: 0;
|
|
221
|
-
width: 2rem;
|
|
222
|
-
border-right: 1px dashed #a9dde0;
|
|
249
|
+
padding-top: 0.3rem;
|
|
250
|
+
padding-bottom: 0.3rem;
|
|
223
251
|
}
|
|
224
252
|
|
|
225
253
|
/* Arrow styling for transclusions */
|
|
226
|
-
dl.terms-and-definitions-list span.transcluded-xref-term::after
|
|
227
|
-
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded::after {
|
|
254
|
+
dl.terms-and-definitions-list span.transcluded-xref-term::after {
|
|
228
255
|
content: "";
|
|
229
256
|
position: absolute;
|
|
230
257
|
left: 0.5rem;
|
|
@@ -244,16 +271,6 @@ dl.terms-and-definitions-list span.transcluded-xref-term {
|
|
|
244
271
|
display: inline-block;
|
|
245
272
|
}
|
|
246
273
|
|
|
247
|
-
dl.terms-and-definitions-list span.transcluded-xref-term::before {
|
|
248
|
-
content: "";
|
|
249
|
-
position: absolute;
|
|
250
|
-
left: 0;
|
|
251
|
-
top: 0;
|
|
252
|
-
bottom: 0;
|
|
253
|
-
width: 1.2rem;
|
|
254
|
-
border-right: 1px dashed #a9dde0;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
274
|
dl.terms-and-definitions-list span.transcluded-xref-term::after {
|
|
258
275
|
width: 0.8rem;
|
|
259
276
|
height: 0.8rem;
|
|
@@ -275,4 +292,5 @@ dl.terms-and-definitions-list span.transcluded-xref-term::after {
|
|
|
275
292
|
font-size: 0.8rem;
|
|
276
293
|
font-variant: small-caps;
|
|
277
294
|
text-transform: uppercase;
|
|
278
|
-
}
|
|
295
|
+
}
|
|
296
|
+
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
function createToggleButton(element) {
|
|
10
10
|
const toggleButton = document.createElement('button');
|
|
11
11
|
toggleButton.classList.add('meta-info-toggle-button', 'btn');
|
|
12
|
-
toggleButton.
|
|
12
|
+
toggleButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16" style="shape-rendering: geometricPrecision;">' +
|
|
13
|
+
'<path fill-rule="evenodd" d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>' +
|
|
14
|
+
'<path d="M8.93 6.588l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588z"/>' +
|
|
15
|
+
'<path d="M9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>' +
|
|
16
|
+
'</svg>';
|
|
13
17
|
toggleButton.title = 'Meta info';
|
|
14
18
|
|
|
15
19
|
// Add event listener to the button
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements Docusaurus-like collapsible navigation menu for the TOC with accessibility support
|
|
3
|
+
*/
|
|
4
|
+
function initCollapsibleMenu() {
|
|
5
|
+
// The TOC is within the #toc container element
|
|
6
|
+
const tocContainer = document.getElementById('toc');
|
|
7
|
+
if (!tocContainer) {
|
|
8
|
+
console.warn("TOC container not found");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Clear any existing toggle buttons to prevent duplicates when reinitializing
|
|
13
|
+
const existingButtons = tocContainer.querySelectorAll('.collapse-toggle');
|
|
14
|
+
existingButtons.forEach(button => button.remove());
|
|
15
|
+
|
|
16
|
+
// Get all TOC list items with children
|
|
17
|
+
// The TOC structure is ul.toc within #toc container
|
|
18
|
+
const tocItems = tocContainer.querySelectorAll('ul li');
|
|
19
|
+
|
|
20
|
+
tocItems.forEach((item, index) => {
|
|
21
|
+
const hasChildren = item.querySelector('ul');
|
|
22
|
+
|
|
23
|
+
if (hasChildren) {
|
|
24
|
+
// Mark item as having children
|
|
25
|
+
item.classList.add('has-children');
|
|
26
|
+
|
|
27
|
+
// Create toggle button
|
|
28
|
+
const toggleBtn = document.createElement('button');
|
|
29
|
+
toggleBtn.className = 'collapse-toggle';
|
|
30
|
+
toggleBtn.setAttribute('aria-label', 'Toggle section');
|
|
31
|
+
toggleBtn.setAttribute('type', 'button');
|
|
32
|
+
toggleBtn.id = `toc-toggle-${index}`;
|
|
33
|
+
|
|
34
|
+
// Find the direct link child of the item to position the button next to it
|
|
35
|
+
const linkElement = item.querySelector(':scope > a');
|
|
36
|
+
|
|
37
|
+
// Improve accessibility by marking the relationship between button and menu
|
|
38
|
+
if (linkElement) {
|
|
39
|
+
// Get the text of the link for the aria-label
|
|
40
|
+
const linkText = linkElement.textContent.trim();
|
|
41
|
+
toggleBtn.setAttribute('aria-label', `Toggle ${linkText} section`);
|
|
42
|
+
|
|
43
|
+
// Add the toggle button next to the link
|
|
44
|
+
linkElement.parentNode.insertBefore(toggleBtn, linkElement.nextSibling);
|
|
45
|
+
|
|
46
|
+
// Connect the link and the toggle button for better accessibility
|
|
47
|
+
hasChildren.setAttribute('role', 'group');
|
|
48
|
+
hasChildren.setAttribute('aria-labelledby', linkElement.id || `toc-item-${index}`);
|
|
49
|
+
|
|
50
|
+
// If the link doesn't have an ID, add one for reference
|
|
51
|
+
if (!linkElement.id) {
|
|
52
|
+
linkElement.id = `toc-item-${index}`;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
// Fallback - just append to the item
|
|
56
|
+
item.appendChild(toggleBtn);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Add aria attributes for accessibility
|
|
60
|
+
toggleBtn.setAttribute('aria-controls', `toc-children-${index}`);
|
|
61
|
+
hasChildren.id = `toc-children-${index}`;
|
|
62
|
+
|
|
63
|
+
// Add click event to toggle button
|
|
64
|
+
toggleBtn.addEventListener('click', (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
|
|
68
|
+
const isCollapsed = item.classList.contains('collapsed');
|
|
69
|
+
|
|
70
|
+
// Toggle collapsed state
|
|
71
|
+
if (isCollapsed) {
|
|
72
|
+
item.classList.remove('collapsed');
|
|
73
|
+
toggleBtn.classList.remove('collapsed');
|
|
74
|
+
toggleBtn.setAttribute('aria-expanded', 'true');
|
|
75
|
+
} else {
|
|
76
|
+
item.classList.add('collapsed');
|
|
77
|
+
toggleBtn.classList.add('collapsed');
|
|
78
|
+
toggleBtn.setAttribute('aria-expanded', 'false');
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Add keyboard navigation
|
|
83
|
+
toggleBtn.addEventListener('keydown', (e) => {
|
|
84
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
toggleBtn.click();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Set initial states - expand the active section, collapse others
|
|
91
|
+
const hasActiveChild = item.querySelector('a.highlight-cfib41dyhcd99sm, a.active');
|
|
92
|
+
if (!hasActiveChild) {
|
|
93
|
+
item.classList.add('collapsed');
|
|
94
|
+
toggleBtn.classList.add('collapsed');
|
|
95
|
+
toggleBtn.setAttribute('aria-expanded', 'false');
|
|
96
|
+
} else {
|
|
97
|
+
toggleBtn.setAttribute('aria-expanded', 'true');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log('Collapsible menu initialized with accessibility improvements');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Log TOC structure to help debugging
|
|
106
|
+
function logTOCStructure() {
|
|
107
|
+
const tocContainer = document.getElementById('toc');
|
|
108
|
+
if (tocContainer) {
|
|
109
|
+
console.log('TOC container found:', tocContainer);
|
|
110
|
+
console.log('TOC container children:', tocContainer.children);
|
|
111
|
+
const firstUL = tocContainer.querySelector('ul');
|
|
112
|
+
if (firstUL) {
|
|
113
|
+
console.log('First UL found:', firstUL);
|
|
114
|
+
console.log('UL class list:', firstUL.classList);
|
|
115
|
+
const listItems = firstUL.querySelectorAll('li');
|
|
116
|
+
console.log('List items count:', listItems.length);
|
|
117
|
+
} else {
|
|
118
|
+
console.warn('No UL found in TOC container');
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
console.warn('TOC container not found');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Run after DOM is fully loaded
|
|
126
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
127
|
+
initCollapsibleMenu();
|
|
128
|
+
// Log the TOC structure for debugging
|
|
129
|
+
logTOCStructure();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Re-initialize when highlighting changes
|
|
133
|
+
document.addEventListener('highlight-menu-item', initCollapsibleMenu);
|
|
@@ -35,8 +35,6 @@ function editTermButtons() {
|
|
|
35
35
|
return path;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// Example usage with the string from the file
|
|
39
|
-
|
|
40
38
|
const cleanedSpecDir = cleanPath(specConfig.spec_directory);
|
|
41
39
|
|
|
42
40
|
// Find all definition terms that have spans with the id of "term:...". These are the definitions we are looking for.
|
|
@@ -44,12 +42,29 @@ function editTermButtons() {
|
|
|
44
42
|
const term = findDeepestSpan(item);
|
|
45
43
|
const url = term.getAttribute('id');
|
|
46
44
|
|
|
47
|
-
// cut
|
|
45
|
+
// cut "url" on the ":" and keep the second part
|
|
48
46
|
const fileName = url.split(":")[1];
|
|
49
47
|
const branch = specConfig.source.branch || "main";
|
|
50
48
|
|
|
51
49
|
// add edit and history buttons to term
|
|
52
|
-
term.innerHTML += `<span class="edit-term-buttons"
|
|
50
|
+
term.innerHTML += `<span class="edit-term-buttons">
|
|
51
|
+
<a title="Link to the term file in the Github repo in a new tab" target="_blank" rel="noopener"
|
|
52
|
+
href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/blob/${branch}/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md"
|
|
53
|
+
class="p-1 edit-term-button btn">
|
|
54
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16" style="shape-rendering: geometricPrecision;">
|
|
55
|
+
<path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
|
|
56
|
+
</svg>
|
|
57
|
+
</a>
|
|
58
|
+
<a title="Link to a GitHub page that shows a history of the edits in a new tab" target="_blank" rel="noopener"
|
|
59
|
+
href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/commits/${branch}/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md"
|
|
60
|
+
class="p-1 history-term-button btn">
|
|
61
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16" style="shape-rendering: geometricPrecision;">
|
|
62
|
+
<path fill-rule="evenodd" d="M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0v1z"/>
|
|
63
|
+
<path fill-rule="evenodd" d="M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5z"/>
|
|
64
|
+
<circle cx="8" cy="8" r="0.3"/>
|
|
65
|
+
</svg>
|
|
66
|
+
</a>
|
|
67
|
+
</span>`;
|
|
53
68
|
});
|
|
54
69
|
}
|
|
55
70
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifies and marks the last <dd> elements in definition lists.
|
|
3
|
+
*
|
|
4
|
+
* This function finds all definition lists with the class 'terms-and-definitions-list'
|
|
5
|
+
* and adds the 'last-dd' class to each <dd> element that is:
|
|
6
|
+
* 1. The last <dd> before the next <dt> element, or
|
|
7
|
+
* 2. The last <dd> in the definition list
|
|
8
|
+
*
|
|
9
|
+
* The 'last-dd' class allows for special styling of the last definition
|
|
10
|
+
* in each term group, improving visual separation between terms.
|
|
11
|
+
*
|
|
12
|
+
* @function fixLastDd
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
function fixLastDd() {
|
|
16
|
+
// Find all definition lists
|
|
17
|
+
const dlElements = document.querySelectorAll('dl.terms-and-definitions-list');
|
|
18
|
+
|
|
19
|
+
dlElements.forEach(dl => {
|
|
20
|
+
// Get all direct dd children of the current dl
|
|
21
|
+
const ddElements = dl.querySelectorAll(':scope > dd');
|
|
22
|
+
|
|
23
|
+
// Process each dd element
|
|
24
|
+
ddElements.forEach((dd, index) => {
|
|
25
|
+
// Get the next sibling element
|
|
26
|
+
let nextSibling = dd.nextElementSibling;
|
|
27
|
+
|
|
28
|
+
// If the next sibling is a dt or there is no next sibling (meaning this is the last element before </dl>)
|
|
29
|
+
if (!nextSibling || nextSibling.tagName === 'DT') {
|
|
30
|
+
// Add the "last-dd" class if it's not already present
|
|
31
|
+
if (!dd.classList.contains('last-dd')) {
|
|
32
|
+
dd.classList.add('last-dd');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Initializes the function when the DOM content is fully loaded.
|
|
41
|
+
*/
|
|
42
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
43
|
+
fixLastDd();
|
|
44
|
+
});
|
|
@@ -18,6 +18,11 @@ function highlightMenuItems() {
|
|
|
18
18
|
if (menuItem) {
|
|
19
19
|
menuItem.classList.add("highlight-cfib41dyhcd99sm");
|
|
20
20
|
menuItem.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
21
|
+
|
|
22
|
+
// Dispatch custom event for the collapsible menu to handle
|
|
23
|
+
document.dispatchEvent(new CustomEvent('highlight-menu-item', {
|
|
24
|
+
detail: { menuItem, headingId: heading.id }
|
|
25
|
+
}));
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -126,12 +126,13 @@ function insertTrefs(allXTrefs) { // Pass allXTrefs as a parameter
|
|
|
126
126
|
|
|
127
127
|
// Create and insert not found message
|
|
128
128
|
const notFoundEl = document.createElement('dd');
|
|
129
|
-
notFoundEl.classList.add('transcluded-xref-term', 'transcluded-xref-term-embedded');
|
|
129
|
+
notFoundEl.classList.add('transcluded-xref-term', 'transcluded-xref-term-embedded', 'last-dd');
|
|
130
130
|
notFoundEl.innerHTML = '<p>This term was not found in the external repository.</p>';
|
|
131
131
|
parent.insertBefore(notFoundEl, metaInfoEl.nextSibling);
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
if (allXTrefs && allXTrefs.xtrefs) {
|
|
137
138
|
processTerms(allXTrefs);
|
|
@@ -6,18 +6,31 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
function pdfDownload() {
|
|
9
|
-
fetch('index.pdf', { method: 'HEAD' })
|
|
9
|
+
fetch('./index.pdf', { method: 'HEAD' })
|
|
10
10
|
.then(response => {
|
|
11
11
|
if (response.ok) {
|
|
12
12
|
let buttonPdfDownload = document.createElement("a");
|
|
13
13
|
buttonPdfDownload.classList.add("button-pdf-download");
|
|
14
|
-
buttonPdfDownload.classList.add("btn");
|
|
14
|
+
buttonPdfDownload.classList.add("btn", "d-block", "btn-sm", "btn-outline-secondary");
|
|
15
15
|
buttonPdfDownload.target = "_blank";
|
|
16
16
|
buttonPdfDownload.rel = "noopener noreferrer";
|
|
17
|
-
buttonPdfDownload.href = "index.pdf";
|
|
17
|
+
buttonPdfDownload.href = "./index.pdf";
|
|
18
18
|
buttonPdfDownload.title = "Download this page as a PDF";
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
// Add PDF icon with transparent fill and text for better visual representation
|
|
21
|
+
buttonPdfDownload.innerHTML = `
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" class="me-1" viewBox="0 0 16 16">
|
|
23
|
+
<path d="M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0H4zm0 1h5v4h4v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zm7 4h-1V2l3 3h-2z"/>
|
|
24
|
+
<path d="M6.5 10.5a.5.5 0 0 1-.5-.5V7.5a.5.5 0 0 1 .5-.5H8a.5.5 0 0 1 .5.5V10a.5.5 0 0 1-.5.5H6.5z"/>
|
|
25
|
+
</svg>
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
// Add additional styling directly to the button
|
|
29
|
+
buttonPdfDownload.style.display = "inline-flex";
|
|
30
|
+
buttonPdfDownload.style.alignItems = "center";
|
|
31
|
+
buttonPdfDownload.style.justifyContent = "center";
|
|
32
|
+
|
|
33
|
+
document.querySelector('.service-menu').prepend(buttonPdfDownload);
|
|
21
34
|
} else {
|
|
22
35
|
console.log('PDF file does not exist. No PDF download button will be added.');
|
|
23
36
|
}
|