spec-up-t 1.1.42 → 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/assets/compiled/body.js +3 -2
- package/assets/compiled/head.css +2 -2
- package/assets/css/collapse-meta-info.css +4 -3
- package/assets/css/terms-and-definitions.css +20 -2
- package/assets/js/collapse-meta-info.js +0 -1
- package/assets/js/insert-trefs.js +148 -0
- package/package.json +1 -1
- package/src/asset-map.json +1 -0
- package/src/prepare-tref.js +2 -29
package/assets/compiled/body.js
CHANGED
|
@@ -132,8 +132,9 @@ var Notyf=function(){"use strict";var t,i=function(){return(i=Object.assign||fun
|
|
|
132
132
|
function showModal(e){const n=document.createElement("div");n.className="spec-up-t-modal-overlay";const c=document.createElement("div");c.className="spec-up-t-modal";const t=document.createElement("button");function o(){document.body.removeChild(n)}t.className="spec-up-t-modal-close",t.innerHTML="×",t.onclick=o,c.innerHTML=e,c.appendChild(t),n.appendChild(c),document.body.appendChild(n),n.onclick=function(e){e.target===n&&o()},document.addEventListener("keydown",(function(e){"Escape"===e.key&&o()}),{once:!0})}
|
|
133
133
|
function tokenInput(){document.querySelector(".button-token-input").addEventListener("click",()=>{const t=prompt("Please enter your GitHub token:");t?(localStorage.setItem("githubToken",t),console.log("GitHub token is set.")):alert("GitHub token is not set.")})}document.addEventListener("DOMContentLoaded",(function(){tokenInput()}));
|
|
134
134
|
function pdfDownload(){fetch("index.pdf",{method:"HEAD"}).then(e=>{if(e.ok){let e=document.createElement("a");e.classList.add("button-pdf-download"),e.classList.add("btn"),e.target="_blank",e.rel="noopener noreferrer",e.href="index.pdf",e.title="Download this page as a PDF",e.innerHTML="PDF",document.querySelector("#container-search-h7vc6omi2hr2880").appendChild(e)}else console.log("PDF file does not exist. No PDF download button will be added.")}).catch(e=>{console.error("Error checking PDF file:",e)})}document.addEventListener("DOMContentLoaded",(function(){pdfDownload()}));
|
|
135
|
+
function insertTrefs(e){var r;e&&e.xtrefs?(r=e,document.querySelectorAll("dt span.transcluded-xref-term").forEach(e=>{const n=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent.trim()).join(""),t=r.xtrefs.find(e=>e.term===n);if(!t)return;const o=document.createElement("dd");o.classList.add("transcluded-xref-term","transcluded-xref-term-embedded");let d=t.content.replace(/\[\[def: ([^,]+),.*?\]\]/g,"").split("\n").map(e=>e.replace(/^\s*~\s*/,"")).join("\n").replace(/\[\[ref:/g,"").replace(/\]\]/g,"");o.innerHTML=md.render(d);const s=document.createElement("dd");s.classList.add("transcluded-xref-term","meta-info-content-wrapper");const a=`\n| Property | Value |\n| -------- | ----- |\n| Owner | ${t.avatarUrl?``:""} ${t.owner||"Unknown"} |\n| Repo | ${t.repo&&t.repoUrl?`[${t.repo}](${t.repoUrl})`:"Unknown"} |\n| Commit hash | ${t.commitHash||"Unknown"} |\n `;s.innerHTML=md.render(a);const l=e.closest("dt");if(l){const e=l.parentNode;e.insertBefore(s,l.nextSibling),e.insertBefore(o,s.nextSibling)}})):console.error("allXTrefs is undefined or missing xtrefs property")}document.addEventListener("DOMContentLoaded",()=>{insertTrefs(allXTrefs)});
|
|
135
136
|
function collapseDefinitions(){const t=document.querySelectorAll("#content dl.terms-and-definitions-list > dd"),e=document.querySelectorAll("#content dl.terms-and-definitions-list > dt"),n=document.querySelectorAll(".collapse-all-defs-button");e.forEach(t=>{const e=document.createElement("button");e.classList.add("collapse-all-defs-button","btn","p-0","fs-5","d-flex","align-items-center","justify-content-center"),e.innerHTML="▲",e.setAttribute("id","toggleButton"),t.appendChild(e)}),document.addEventListener("click",e=>{e.target.classList.contains("collapse-all-defs-button")&&(!function(){const e=t[0].classList.contains("hidden");t.forEach(t=>{t.classList.toggle("hidden",!e),t.classList.toggle("visible",e)}),n.forEach(t=>{t.innerHTML=e?"▲":"▼",t.title=e?"Collapse all definitions":"Expand all definitions"})}(),e.target.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}),setTimeout(()=>{window.scrollBy({top:-100,behavior:"smooth"})},500))})}document.addEventListener("DOMContentLoaded",(function(){collapseDefinitions()}));
|
|
136
|
-
function createToggleButton(t){const e=document.createElement("button");e.classList.add("meta-info-toggle-button","btn"),e.textContent="ℹ️",e.title="Meta info",e.addEventListener("click",(function(){t.classList.toggle("collapsed"),t.classList.contains("collapsed"),this.textContent="ℹ️"}));let n=t.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?n.appendChild(e):t.insertBefore(e,t.firstChild)}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("dl > dd:has(table)").forEach((function(t){const e=document.createElement("div");for(
|
|
137
|
+
function createToggleButton(t){const e=document.createElement("button");e.classList.add("meta-info-toggle-button","btn"),e.textContent="ℹ️",e.title="Meta info",e.addEventListener("click",(function(){t.classList.toggle("collapsed"),t.classList.contains("collapsed"),this.textContent="ℹ️"}));let n=t.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?n.appendChild(e):t.insertBefore(e,t.firstChild)}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("dl > dd:has(table)").forEach((function(t){const e=document.createElement("div");for(;t.firstChild&&t.firstChild!==t.querySelector(".meta-info-toggle-button");)e.appendChild(t.firstChild);t.querySelector(".meta-info-toggle-button")||createToggleButton(t),t.appendChild(e),t.classList.add("collapsed")}))}));
|
|
137
138
|
/**
|
|
138
139
|
* @file This file adds an href attribute to the snapshot link on the page via client side JS DOM manipulation.
|
|
139
140
|
* @author Kor Dwarshuis
|
|
@@ -142,7 +143,7 @@ function createToggleButton(t){const e=document.createElement("button");e.classL
|
|
|
142
143
|
* @since 2024-09-25
|
|
143
144
|
*/
|
|
144
145
|
function addHrefToSnapshotLink(){const e=document.querySelector("#snapshotLink"),t=window.location.href,n=t.match(/^(https?:\/\/[^\/]+(?:\/[^\/]+)*)\/versions\/(?:[^\/]+\/)?/);let o;if(n)o=n[1]+"/versions/";else{o=t.split("#")[0].replace(/\/index\.html$/,"").replace(/\/$/,"")+"/versions/"}e&&e.setAttribute("href",o)}document.addEventListener("DOMContentLoaded",(function(){addHrefToSnapshotLink()}));
|
|
145
|
-
function adjustFontSize(){const e=document.body
|
|
146
|
+
function adjustFontSize(){const e=document.body;parseFloat(window.getComputedStyle(e).fontSize);function t(t){let n=parseFloat(window.getComputedStyle(e).fontSize)+t;n>=10&&n<=50&&(e.style.fontSize=n+"px")}document.getElementById("decreaseBtn").addEventListener("click",()=>t(-2)),document.getElementById("increaseBtn").addEventListener("click",()=>t(2))}document.addEventListener("DOMContentLoaded",(function(){adjustFontSize()}));
|
|
146
147
|
function closeOffCanvasMenu(){document.querySelectorAll("#sidebarMenu a").forEach(e=>{e.addEventListener("click",(function(){const e=document.querySelector("#sidebarMenu");bootstrap.Offcanvas.getOrCreateInstance(e).hide()}))})}document.addEventListener("DOMContentLoaded",(function(){closeOffCanvasMenu()}));
|
|
147
148
|
!function(){var e=window.markdownit();let t=specConfig.source;t&&"github"===t.host&&fetch(`https://api.github.com/repos/${t.account+"/"+t.repo}/issues`).then(e=>e.json()).then(t=>{let n=t.length;document.querySelectorAll("[issue-count]").forEach(e=>{e.setAttribute("issue-count",n)}),repo_issue_list.innerHTML=t.map(t=>`<li class="repo-issue">\n <detail-box>\n <section>${e.render(t.body||"")}</section>\n <header class="repo-issue-title">\n <span class="repo-issue-number">${t.number}</span>\n <span class="repo-issue-link">\n <a href="${t.html_url}" target="_blank">${t.title}</a>\n </span>\n <span detail-box-toggle></span>\n </header>\n </detail-box>\n </li>`).join(""),Prism.highlightAllUnder(repo_issue_list)}),mermaid.initialize({startOnLoad:!0,theme:"neutral"}),document.querySelectorAll(".chartjs").forEach(e=>{new Chart(e,JSON.parse(e.textContent))});let n=new WeakMap;delegateEvent("pointerover",".term-reference, .spec-reference",(e,t)=>{const r=t.getAttribute("data-local-href")||t.getAttribute("href")||"";let s=document.getElementById(r.replace("#",""));if(!s||n.has(t))return;let i=s.closest("dt, td:first-child");if(!i)return;let l={allowHTML:!0,inlinePositioning:!0};switch(i.tagName){case"DT":l.content=i.nextElementSibling.textContent;break;case"TD":let e=i.closest("table"),t=Array.from(i.closest("tr").children);if(t.shift(),e){let n=Array.from(e.querySelectorAll("thead th"));n.shift(),n.length&&(l.content=`\n <header>${i.textContent}</header>\n <table>\n ${n.map((e,n)=>`<tr><td>${e.textContent}:</td><td>${t[n]?t[n].textContent:""}</td></tr>`).join("")}\n </table>`)}}l.content&&n.set(t,tippy(t,l))},{passive:!0})}();
|
|
148
149
|
function addClassToTranscludedTerms(){document.querySelectorAll("span.transcluded-xref-term").forEach(e=>{const t=e.closest("dt");if(t){t.classList.add("transcluded-xref-term");let e=t.nextElementSibling;for(;e&&"DT"!==e.tagName&&"DL"!==e.tagName;)"DD"===e.tagName&&e.classList.add("transcluded-xref-term"),e=e.nextElementSibling}})}document.addEventListener("DOMContentLoaded",(function(){addClassToTranscludedTerms()}));
|
package/assets/compiled/head.css
CHANGED
|
@@ -8,11 +8,11 @@ code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-fami
|
|
|
8
8
|
#back-to-top-a1zncgtqfpzsig8{position:fixed;bottom:20px;text-decoration:none;left:calc(100% - 1.8em);width:1.5em;height:1.5em;margin:0;padding:0;background-color:#1e6eae;color:#222;border-radius:50px;text-align:center;font-size:30px;color:#fff;box-shadow:0 0 1.3px rgba(0,0,0,.07),0 0 3.6px rgba(0,0,0,.1),0 0 8.7px rgba(0,0,0,.13),0 0 29px rgba(0,0,0,.2);cursor:pointer;border:none;display:none;align-items:center;justify-content:center}
|
|
9
9
|
@-webkit-keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@-webkit-keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@-webkit-keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@-webkit-keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@-webkit-keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}@keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}.notyf{position:fixed;top:0;left:0;height:100%;width:100%;color:#fff;z-index:9999;display:flex;flex-direction:column;align-items:flex-end;justify-content:flex-end;pointer-events:none;box-sizing:border-box;padding:20px}.notyf__icon--error,.notyf__icon--success{height:21px;width:21px;background:#fff;border-radius:50%;display:block;margin:0 auto;position:relative}.notyf__icon--error:after,.notyf__icon--error:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px;left:9px;height:12px;top:5px}.notyf__icon--error:after{transform:rotate(-45deg)}.notyf__icon--error:before{transform:rotate(45deg)}.notyf__icon--success:after,.notyf__icon--success:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px}.notyf__icon--success:after{height:6px;transform:rotate(-45deg);top:9px;left:6px}.notyf__icon--success:before{height:11px;transform:rotate(45deg);top:5px;left:10px}.notyf__toast{display:block;overflow:hidden;pointer-events:auto;-webkit-animation:notyf-fadeinup .3s ease-in forwards;animation:notyf-fadeinup .3s ease-in forwards;box-shadow:0 3px 7px 0 rgba(0,0,0,.25);position:relative;padding:0 15px;border-radius:2px;max-width:300px;transform:translateY(25%);box-sizing:border-box;flex-shrink:0}.notyf__toast--disappear{transform:translateY(0);-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s}.notyf__toast--disappear .notyf__icon,.notyf__toast--disappear .notyf__message{-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;opacity:1;transform:translateY(0)}.notyf__toast--disappear .notyf__dismiss{-webkit-animation:notyf-fadeoutright .3s forwards;animation:notyf-fadeoutright .3s forwards;opacity:1;transform:translateX(0)}.notyf__toast--disappear .notyf__message{-webkit-animation-delay:.05s;animation-delay:.05s}.notyf__toast--upper{margin-bottom:20px}.notyf__toast--lower{margin-top:20px}.notyf__toast--dismissible .notyf__wrapper{padding-right:30px}.notyf__ripple{height:400px;width:400px;position:absolute;transform-origin:bottom right;right:0;top:0;border-radius:50%;transform:scale(0) translateY(-51%) translateX(13%);z-index:5;-webkit-animation:ripple .4s ease-out forwards;animation:ripple .4s ease-out forwards}.notyf__wrapper{display:flex;align-items:center;padding-top:17px;padding-bottom:17px;padding-right:15px;border-radius:3px;position:relative;z-index:10}.notyf__icon{width:22px;text-align:center;font-size:1.3em;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.3s;animation-delay:.3s;margin-right:13px}.notyf__dismiss{position:absolute;top:0;right:0;height:100%;width:26px;margin-right:-15px;-webkit-animation:notyf-fadeinleft .3s forwards;animation:notyf-fadeinleft .3s forwards;-webkit-animation-delay:.35s;animation-delay:.35s;opacity:0}.notyf__dismiss-btn{background-color:rgba(0,0,0,.25);border:none;cursor:pointer;transition:opacity .2s ease,background-color .2s ease;outline:0;opacity:.35;height:100%;width:100%}.notyf__dismiss-btn:after,.notyf__dismiss-btn:before{content:"";background:#fff;height:12px;width:2px;border-radius:3px;position:absolute;left:calc(50% - 1px);top:calc(50% - 5px)}.notyf__dismiss-btn:after{transform:rotate(-45deg)}.notyf__dismiss-btn:before{transform:rotate(45deg)}.notyf__dismiss-btn:hover{opacity:.7;background-color:rgba(0,0,0,.15)}.notyf__dismiss-btn:active{opacity:.8}.notyf__message{vertical-align:middle;position:relative;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s;line-height:1.5em}@media only screen and (max-width:480px){.notyf{padding:0}.notyf__ripple{height:600px;width:600px;-webkit-animation-duration:.5s;animation-duration:.5s}.notyf__toast{max-width:none;border-radius:0;box-shadow:0 -2px 7px 0 rgba(0,0,0,.13);width:100%}.notyf__dismiss{width:56px}}
|
|
10
10
|
#content dl dd.hidden{display:none}#content dl dd.visible{display:block}.collapse-all-defs-button{float:right}
|
|
11
|
-
dl>dd:has(table)
|
|
11
|
+
dl>dd:has(table).meta-info-content-wrapper{max-height:10em;transition:max-height .3s ease-out}dl>dd:has(table).collapsed.meta-info-content-wrapper{padding-top:0;padding-bottom:0;overflow:hidden;transition:max-height .3s ease-out;max-height:0;line-height:0}
|
|
12
12
|
.spec-up-t-modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);display:flex;justify-content:center;align-items:center;z-index:1000}.spec-up-t-modal{background-color:#fff;padding:2rem 20px 20px;border-radius:8px;max-width:80%;max-height:80%;overflow-y:auto;position:relative;box-shadow:0 2px 10px rgba(0,0,0,.1)}.spec-up-t-modal-close{position:absolute;top:0;right:5px;background-color:transparent;border:none;font-size:2rem;line-height:1;cursor:pointer}
|
|
13
13
|
.alphabet-index-container{margin-bottom:1em}.alphabet-index-container,.number-of-terms{font-size:.8em;text-align:center;width:100%}.alphabet-index-container a{background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:50%;color:#333;display:inline-block;font-size:.9rem;height:30px;line-height:30px;margin:2px;text-align:center;text-decoration:none;width:30px}
|
|
14
14
|
.button-pdf-download{padding-left:.1em;padding-right:.1em;border:none;background:red;color:#fff;box-shadow:2.8px 2.8px 2.2px rgba(0,0,0,.02),6.7px 6.7px 5.3px rgba(0,0,0,.028),12.5px 12.5px 10px rgba(0,0,0,.035),22.3px 22.3px 17.9px rgba(0,0,0,.042),41.8px 41.8px 33.4px rgba(0,0,0,.05),100px 100px 80px rgba(0,0,0,.07)}
|
|
15
|
-
h2,h3,h4,h5,h6{margin-top:1.5em!important}.toc-anchor{font-size:.875em;color:inherit;text-decoration:none;color:#73c2df;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}#terminology-section-utility-container{display:flex;flex-wrap:wrap;justify-content:center;margin:1em auto;padding:0;width:100%}@media (min-width:576px){#terminology-section-utility-container{position:sticky;top:3.5em}}.transcluded-xref-term{background:#a9dde03b!important;padding:.5em;margin:1em 0}.transclusion-heading{font-size:1.3em;font-weight:700;margin:1em 0 .5em}.btn,.no-xref-found-message{font-variant:small-caps;text-transform:uppercase}.no-xref-found-message{background:#f8c481!important;color:#03365f!important;margin:0 .5em;padding:0 .8em;border-radius:.25rem;font-size:.8rem}dl.terms-and-definitions-list{margin:0;padding:0}dl.terms-and-definitions-list>dt{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.1rem 1.25rem;border-radius:.375rem .375rem 0 0;box-shadow:0 .125rem .25rem var(--card-shadow);color:var(--card-text)}dl.terms-and-definitions-list>dd{margin:0;background-color:var(--card-bg);border:1px solid var(--card-border);border-top:none;padding:1rem 1.25rem;
|
|
15
|
+
h2,h3,h4,h5,h6{margin-top:1.5em!important}.toc-anchor{font-size:.875em;color:inherit;text-decoration:none;color:#73c2df;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}#terminology-section-utility-container{display:flex;flex-wrap:wrap;justify-content:center;margin:1em auto;padding:0;width:100%}@media (min-width:576px){#terminology-section-utility-container{position:sticky;top:3.5em}}.transcluded-xref-term{background:#a9dde03b!important;padding:.5em;margin:1em 0}.transclusion-heading{font-size:1.3em;font-weight:700;margin:1em 0 .5em}dl.terms-and-definitions-list>dd.transcluded-xref-term-embedded{background-image:linear-gradient(45deg,hsl(190deg 60% 95%) 0,hsl(189deg 60% 93%) 8%,hsl(189deg 60% 91%) 17%,hsl(188deg 60% 89%) 25%,hsl(188deg 60% 87%) 33%,hsl(187deg 60% 85%) 42%,hsl(186deg 60% 83%) 50%,hsl(190deg 60% 83%) 58%,hsl(193deg 60% 83%) 67%,hsl(197deg 60% 83%) 75%,hsl(202deg 60% 83%) 83%,hsl(207deg 60% 83%) 92%,hsl(212deg 60% 83%) 100%)!important}.btn,.no-xref-found-message{font-variant:small-caps;text-transform:uppercase}.no-xref-found-message{background:#f8c481!important;color:#03365f!important;margin:0 .5em;padding:0 .8em;border-radius:.25rem;font-size:.8rem}dl.terms-and-definitions-list{margin:0;padding:0}dl.terms-and-definitions-list>dt{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.1rem 1.25rem;border-radius:.375rem .375rem 0 0;box-shadow:0 .125rem .25rem var(--card-shadow);color:var(--card-text)}dl.terms-and-definitions-list>dd{margin:0;background-color:var(--card-bg);border:1px solid var(--card-border);border-top:none;padding:1rem 1.25rem;color:var(--card-text);overflow:scroll;width:100%}dl.terms-and-definitions-list dd p{margin:0;color:var(--card-text)}dl.terms-and-definitions-list dt+dd{border-bottom:none}dl.terms-and-definitions-list dd+dd{border-top:none;border-bottom:none}dl.terms-and-definitions-list dd+dt{margin-top:1.5rem}dl.terms-and-definitions-list dd.last-dd{border-radius:0 0 .375rem .375rem;border-bottom:1px solid var(--card-border)}dl.terms-and-definitions-list>dt:hover{background-color:var(--card-hover-bg);transition:background-color .2s ease-in-out}
|
|
16
16
|
@charset "UTF-8";/*!
|
|
17
17
|
* Bootstrap v5.3.3 (https://getbootstrap.com/)
|
|
18
18
|
* Copyright 2011-2024 The Bootstrap Authors
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
Description: Make the meta-info tables collapsible
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
dl>dd:has(table)
|
|
8
|
-
max-height:
|
|
7
|
+
dl>dd:has(table).meta-info-content-wrapper {
|
|
8
|
+
max-height: 10em;
|
|
9
9
|
transition: max-height 0.3s ease-out;
|
|
10
10
|
/* This should be higher than the tallest content */
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
dl>dd:has(table).collapsed
|
|
13
|
+
dl>dd:has(table).collapsed.meta-info-content-wrapper {
|
|
14
14
|
padding-top: 0;
|
|
15
15
|
padding-bottom: 0;
|
|
16
16
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
transition: max-height 0.3s ease-out;
|
|
19
19
|
max-height: 0;
|
|
20
|
+
line-height: 0;
|
|
20
21
|
}
|
|
@@ -52,6 +52,26 @@ h2,h3,h4,h5,h6 {
|
|
|
52
52
|
font-weight: bold;
|
|
53
53
|
margin: 1em 0 0.5em;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
dl.terms-and-definitions-list>dd.transcluded-xref-term-embedded {
|
|
57
|
+
background-image: linear-gradient(45deg,
|
|
58
|
+
hsl(190deg 60% 95%) 0%,
|
|
59
|
+
hsl(189deg 60% 93%) 8%,
|
|
60
|
+
hsl(189deg 60% 91%) 17%,
|
|
61
|
+
hsl(188deg 60% 89%) 25%,
|
|
62
|
+
hsl(188deg 60% 87%) 33%,
|
|
63
|
+
hsl(187deg 60% 85%) 42%,
|
|
64
|
+
hsl(186deg 60% 83%) 50%,
|
|
65
|
+
hsl(190deg 60% 83%) 58%,
|
|
66
|
+
hsl(193deg 60% 83%) 67%,
|
|
67
|
+
hsl(197deg 60% 83%) 75%,
|
|
68
|
+
hsl(202deg 60% 83%) 83%,
|
|
69
|
+
hsl(207deg 60% 83%) 92%,
|
|
70
|
+
hsl(212deg 60% 83%) 100%) !important;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
55
75
|
/* End Transclusions */
|
|
56
76
|
|
|
57
77
|
|
|
@@ -98,8 +118,6 @@ dl.terms-and-definitions-list>dd {
|
|
|
98
118
|
border: 1px solid var(--card-border);
|
|
99
119
|
border-top: none;
|
|
100
120
|
padding: 1rem 1.25rem;
|
|
101
|
-
/* Consistent Bootstrap card-body padding */
|
|
102
|
-
box-shadow: 0 0.125rem 0.25rem var(--card-shadow);
|
|
103
121
|
color: var(--card-text);
|
|
104
122
|
overflow: scroll;
|
|
105
123
|
width: 100%;
|
|
@@ -42,7 +42,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
|
42
42
|
collapsibles.forEach(function (element) {
|
|
43
43
|
// Wrap content (excluding button) in a div for easy toggling
|
|
44
44
|
const wrapper = document.createElement('div');
|
|
45
|
-
wrapper.classList.add('meta-info-content-wrapper');
|
|
46
45
|
|
|
47
46
|
// Move all children except potential existing buttons into wrapper
|
|
48
47
|
while (element.firstChild && element.firstChild !== element.querySelector('.meta-info-toggle-button')) {
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Inserts transcluded external references (trefs) into the document.
|
|
3
|
+
*
|
|
4
|
+
* This script enhances an HTML document by adding definitions and meta information
|
|
5
|
+
* for terms marked with `<span class="transcluded-xref-term">` inside `<dt>` elements
|
|
6
|
+
* within a `<dl>` structure. It matches these terms against an external data source,
|
|
7
|
+
* renders the corresponding content and meta information from markdown to HTML,
|
|
8
|
+
* and inserts them as `<dd>` elements following each matching `<dt>`. The script
|
|
9
|
+
* executes automatically when the DOM is fully loaded via a `DOMContentLoaded` event listener.
|
|
10
|
+
*
|
|
11
|
+
* ### Dependencies
|
|
12
|
+
* - **`allXTrefs`**: A global object containing the external references to be transcluded.
|
|
13
|
+
* - **`md`**: A markdown renderer object with a `render` method to convert markdown to HTML.
|
|
14
|
+
*
|
|
15
|
+
* ### Data Structure
|
|
16
|
+
* The `allXTrefs` object must have the following structure:
|
|
17
|
+
* ```javascript
|
|
18
|
+
* {
|
|
19
|
+
* xtrefs: [
|
|
20
|
+
* {
|
|
21
|
+
* term: string, // The term to match against the <span> text content
|
|
22
|
+
* content: string, // Markdown content for the definition
|
|
23
|
+
* owner: string, // Owner of the source repository
|
|
24
|
+
* repo: string, // Repository name
|
|
25
|
+
* repoUrl: string, // URL to the repository
|
|
26
|
+
* commitHash: string, // Commit hash of the source
|
|
27
|
+
* avatarUrl: string // URL to the owner's avatar
|
|
28
|
+
* },
|
|
29
|
+
* // Additional reference objects...
|
|
30
|
+
* ]
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ### Behavior
|
|
35
|
+
* The script:
|
|
36
|
+
* 1. Identifies all `<dt>` elements containing `<span class="transcluded-xref-term">`.
|
|
37
|
+
* 2. Extracts the text content of each `<span>`.
|
|
38
|
+
* 3. Searches for a matching `term` in `allXTrefs.xtrefs`.
|
|
39
|
+
* 4. If a match is found, creates:
|
|
40
|
+
* - A `<dd>` element with the rendered `content` (markdown to HTML).
|
|
41
|
+
* - A `<dd>` element with meta information (e.g., owner, repo, commit hash) also rendered from markdown.
|
|
42
|
+
* 5. Inserts these `<dd>` elements after the corresponding `<dt>`.
|
|
43
|
+
*
|
|
44
|
+
* ### DOM Modifications
|
|
45
|
+
* The script modifies the DOM by appending new `<dd>` elements after each matching `<dt>`.
|
|
46
|
+
*
|
|
47
|
+
* @requires {Object} allXTrefs - The external data source containing the references.
|
|
48
|
+
* @requires {Object} md - A markdown renderer with a `render` method (e.g., marked.js or similar).
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Define dependencies in a <script> tag before this script:
|
|
52
|
+
* window.allXTrefs = {
|
|
53
|
+
* xtrefs: [
|
|
54
|
+
* {
|
|
55
|
+
* term: "example",
|
|
56
|
+
* content: "This is an **example** definition.",
|
|
57
|
+
* owner: "user",
|
|
58
|
+
* repo: "glossary",
|
|
59
|
+
* repoUrl: "https://github.com/user/glossary",
|
|
60
|
+
* commitHash: "abc123",
|
|
61
|
+
* avatarUrl: "https://github.com/user.png"
|
|
62
|
+
* }
|
|
63
|
+
* ]
|
|
64
|
+
* };
|
|
65
|
+
* window.md = { render: function(markdown) { return "<p>" + markdown + "</p>"; } };
|
|
66
|
+
*
|
|
67
|
+
* // HTML example:
|
|
68
|
+
* // <dl>
|
|
69
|
+
* // <dt><span class="transcluded-xref-term">example</span></dt>
|
|
70
|
+
* // </dl>
|
|
71
|
+
* // After script execution:
|
|
72
|
+
* // <dl>
|
|
73
|
+
* // <dt><span class="transcluded-xref-term">example</span></dt>
|
|
74
|
+
* // <dd> … table with meta info … </dd>
|
|
75
|
+
* // <dd><p>This is an <strong>example</strong> definition.</p></dd>
|
|
76
|
+
* // </dl>
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
function insertTrefs(allXTrefs) { // Pass allXTrefs as a parameter
|
|
80
|
+
function processTerms(xtrefsData) {
|
|
81
|
+
const termElements = document.querySelectorAll('dt span.transcluded-xref-term');
|
|
82
|
+
|
|
83
|
+
termElements.forEach(termElement => {
|
|
84
|
+
// Get the text content of the element, excluding its child nodes
|
|
85
|
+
const textContent = Array.from(termElement.childNodes)
|
|
86
|
+
.filter(node => node.nodeType === Node.TEXT_NODE)
|
|
87
|
+
.map(node => node.textContent.trim())
|
|
88
|
+
.join('');
|
|
89
|
+
|
|
90
|
+
// Find the first matching xref to avoid duplicates
|
|
91
|
+
const xref = xtrefsData.xtrefs.find(x => x.term === textContent);
|
|
92
|
+
if (!xref) return; // Skip if no match
|
|
93
|
+
|
|
94
|
+
// Create definition <dd>
|
|
95
|
+
const ddTrefDef = document.createElement('dd');
|
|
96
|
+
ddTrefDef.classList.add('transcluded-xref-term', 'transcluded-xref-term-embedded');
|
|
97
|
+
|
|
98
|
+
// Clean up markdown content
|
|
99
|
+
let content = xref.content
|
|
100
|
+
.replace(/\[\[def: ([^,]+),.*?\]\]/g, '') // Remove [[def: ...]]
|
|
101
|
+
.split('\n')
|
|
102
|
+
.map(line => line.replace(/^\s*~\s*/, '')) // Remove leading ~ and spaces
|
|
103
|
+
.join('\n')
|
|
104
|
+
.replace(/\[\[ref:/g, '') // Remove [[ref: ...]]
|
|
105
|
+
.replace(/\]\]/g, '');
|
|
106
|
+
|
|
107
|
+
ddTrefDef.innerHTML = md.render(content);
|
|
108
|
+
|
|
109
|
+
// Create meta info <dd>
|
|
110
|
+
const ddMetaInfo = document.createElement('dd');
|
|
111
|
+
ddMetaInfo.classList.add('transcluded-xref-term', 'meta-info-content-wrapper');
|
|
112
|
+
|
|
113
|
+
// Handle missing xref properties
|
|
114
|
+
const avatar = xref.avatarUrl ? `` : '';
|
|
115
|
+
const owner = xref.owner || 'Unknown';
|
|
116
|
+
const repo = xref.repo && xref.repoUrl ? `[${xref.repo}](${xref.repoUrl})` : 'Unknown';
|
|
117
|
+
const commitHash = xref.commitHash || 'Unknown';
|
|
118
|
+
|
|
119
|
+
const metaInfo = `
|
|
120
|
+
| Property | Value |
|
|
121
|
+
| -------- | ----- |
|
|
122
|
+
| Owner | ${avatar} ${owner} |
|
|
123
|
+
| Repo | ${repo} |
|
|
124
|
+
| Commit hash | ${commitHash} |
|
|
125
|
+
`;
|
|
126
|
+
ddMetaInfo.innerHTML = md.render(metaInfo);
|
|
127
|
+
|
|
128
|
+
// Insert both <dd> elements in the correct order
|
|
129
|
+
const dt = termElement.closest('dt');
|
|
130
|
+
if (dt) {
|
|
131
|
+
const parent = dt.parentNode;
|
|
132
|
+
parent.insertBefore(ddMetaInfo, dt.nextSibling); // Meta info first
|
|
133
|
+
parent.insertBefore(ddTrefDef, ddMetaInfo.nextSibling); // Definition second
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (allXTrefs && allXTrefs.xtrefs) {
|
|
139
|
+
processTerms(allXTrefs);
|
|
140
|
+
} else {
|
|
141
|
+
console.error('allXTrefs is undefined or missing xtrefs property');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
146
|
+
// Assuming allXTrefs is available globally or fetched elsewhere
|
|
147
|
+
insertTrefs(allXTrefs); // Adjust based on how allXTrefs is provided
|
|
148
|
+
});
|
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/asset-map.json
CHANGED
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
|
|