spec-up-t 1.6.0-beta.1 → 1.6.0-beta.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 +1 -1
- package/assets/compiled/head.css +2 -2
- package/assets/css/refs.css +4 -1
- package/assets/css/terms-and-definitions.css +6 -6
- package/assets/js/insert-irefs.js +3 -3
- package/package.json +1 -1
- package/src/install-from-boilerplate/boilerplate/spec/terms-and-definitions-intro.md +1 -1
- package/src/parsers/template-tag-parser.js +9 -3
- package/src/utils/regex-patterns.js +22 -0
package/assets/compiled/body.js
CHANGED
|
@@ -111,7 +111,7 @@ function showModal(e){const n=document.createElement("div");n.className="spec-up
|
|
|
111
111
|
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()}));
|
|
112
112
|
!function(){"use strict";const e=e=>document.querySelector(e);async function t(){const t=e(".service-menu");if(!t)return;const n=[{href:"./index.pdf",title:"Download this page as a PDF",cls:"button-pdf-download"},{href:"./index.docx",title:"Download this page as a DOCX",cls:"button-docx-download"}],o=await Promise.all(n.map((e=>{return t=e.href,fetch(t,{method:"HEAD"}).then((e=>e.ok)).catch((()=>!1));var t})));let r=t.firstElementChild;n.forEach(((n,a)=>{if(!o[a])return;if(s=n.cls,e(`.service-menu .${s}`))return;var s;const c=function(e,t,n){const o=document.createElement("a");return o.classList.add(n,"btn","d-block","btn-sm","btn-outline-secondary"),o.target="_blank",o.rel="noopener noreferrer",o.href=e,o.title=t,o.setAttribute("aria-label",t),o.innerHTML='<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"> <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"/> </svg>',o}(n.href,n.title,n.cls);t.insertBefore(c,r),r=c}))}window.SpecUpDownloads={addButtons:t},document.addEventListener("DOMContentLoaded",t,{once:!1});try{document.dispatchEvent(new CustomEvent("specup-downloads-ready"))}catch(e){}}();
|
|
113
113
|
function insertTrefs(e){!function(e){const n=[];document.querySelectorAll("dl.terms-and-definitions-list dt span.term-external").forEach((e=>{const t=e.dataset.originalTerm,r=e.closest("dt");if(r){const e=r.nextElementSibling;if(e?.classList.contains("term-external")&&e.classList.contains("meta-info-content-wrapper"))return}n.push({element:e,textContent:t,dt:r,parent:r?.parentNode})}));const t=n.map((n=>{const{textContent:t,dt:r,parent:o}=n;if(!r||!o)return null;const i=e.xtrefs.find((e=>e.term===t)),a=document.createDocumentFragment(),s=document.createElement("dd");if(s.classList.add("term-external","meta-info-content-wrapper","collapsed"),i){const e=i.avatarUrl?``:"",n=i.owner||"Unknown",r=i.repo&&i.repoUrl?`[${i.repo}](${i.repoUrl})`:"Unknown",o=i.commitHash||"Unknown",d=i.ghPageUrl?new URL(`#term:${i.term}`,i.ghPageUrl).href:"Unknown",l=`\n| Property | Value |\n| -------- | ----- |\n| Original Term | ${t} |\n| Link | ${d} |\n| Owner | ${e} ${n} |\n| Repo | ${r} |\n| Commit hash | ${o} |\n `;s.innerHTML=md.render(l),a.appendChild(s);let c=i.content.split("\n").map((e=>e.replace(/^\s*~\s*/,""))).join("\n").replace(/\]\]/g,"");const m=document.createElement("div");m.innerHTML=md.render(c),m.querySelectorAll("a").forEach((e=>{const n=e=>{try{return null!==document.getElementById(e)}catch{return!1}};try{const t=new URL(e.href);if(t.hostname!==window.location.hostname)return;if(t.hash&&n(t.hash.slice(1)))return;e.replaceWith(...e.childNodes)}catch{if(e.href.startsWith("#")&&n(e.href.slice(1)))return;e.replaceWith(...e.childNodes)}})),c=m.innerHTML;const f=document.createElement("div");f.innerHTML=md.render(c);const p=f.querySelectorAll("dd");if(p.length>0)Array.from(p).forEach((e=>{const n=e.cloneNode(!0);n.classList.add("term-external","term-external-embedded"),a.appendChild(n)}));else{const e=document.createElement("dd");e.classList.add("term-external","term-external-embedded"),e.innerHTML=f.innerHTML,a.appendChild(e)}}else{s.innerHTML=md.render("\n| Property | Value |\n| -------- | ----- |\n| Owner | Unknown |\n| Repo | Unknown |\n| Commit hash | not found |\n "),a.appendChild(s);const e=document.createElement("dd");e.innerHTML="<p>This term was not found in the external repository.</p>",a.appendChild(e)}return{dt:r,parent:o,fragment:a}})).filter(Boolean);requestAnimationFrame((()=>{t.forEach((e=>{const{dt:n,parent:t,fragment:r}=e;t.insertBefore(r,n.nextSibling)})),document.dispatchEvent(new CustomEvent("trefs-inserted",{detail:{count:t.length}}))}))}(e)}function initializeOnTrefsInserted(e){let n=!1;document.addEventListener("trefs-inserted",(function(t){n||(n=!0,e(),t.detail&&console.log(`Collapsible definitions initialized after ${t.detail.count} xrefs were inserted`))})),setTimeout((()=>{n||(console.warn("trefs-inserted event was not received, initializing collapsible definitions anyway"),e(),n=!0)}),1e3)}document.addEventListener("DOMContentLoaded",(()=>{"undefined"!=typeof allXTrefs&&allXTrefs?.xtrefs?insertTrefs(allXTrefs):(console.error("allXTrefs is undefined or missing xtrefs property"),document.dispatchEvent(new CustomEvent("trefs-inserted",{detail:{count:0,error:"Missing xtrefs data"}})))}));
|
|
114
|
-
function insertIrefs(){!function(){const e=document.querySelectorAll("span.iref-placeholder");if(0===e.length)return void document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:0}}));const t=[];e.forEach((e=>{const n=e.dataset.irefTerm,r=e.dataset.irefOriginal;if(!n)return void console.warn("iref placeholder missing data-iref-term attribute",e);const i
|
|
114
|
+
function insertIrefs(){!function(){const e=document.querySelectorAll("span.iref-placeholder");if(0===e.length)return void document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:0}}));const t=[];e.forEach((e=>{const n=e.dataset.irefTerm,r=e.dataset.irefOriginal;if(!n)return void console.warn("iref placeholder missing data-iref-term attribute",e);const i=`term:${n}`,o=document.getElementById(i);if(!o){console.warn(`iref: term "${r}" (id: ${n}) not found in terms-and-definitions-list`);const i=document.createElement("div");i.className="iref-not-found",i.innerHTML=`<p class="text-warning"><em>[[iref: ${r}]] - Term not found in definitions list</em></p>`;const o=document.createDocumentFragment();return o.appendChild(i),void t.push({placeholder:e,fragment:o})}const d=o.closest("dt");if(!d)return void console.warn(`iref: could not find <dt> element for term "${r}"`);const l=document.createDocumentFragment(),c=document.createElement("div");c.className="iref-content";const s=document.createElement("dl");s.className="iref-definition-list";const a=d.cloneNode(!0);a.classList.add("iref-term"),a.classList.add("term-reference");const m=a.querySelector("a.toc-anchor");m&&m.remove();a.querySelectorAll("[id]").forEach((e=>{e.removeAttribute("id")}));const f=d.querySelector('[id^="term:"]');if(f){const e=f.getAttribute("id"),t=document.createElement("a");for(t.href=`#${e}`,t.className="iref-link-to-original",t.title=`Go to original definition of ${r}`;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t)}s.appendChild(a);let u=d.nextElementSibling;for(;u&&"dd"===u.tagName.toLowerCase();){const e=u.cloneNode(!0);e.classList.add("iref-definition"),s.appendChild(e),u=u.nextElementSibling}c.appendChild(s),l.appendChild(c),t.push({placeholder:e,fragment:l})})),requestAnimationFrame((()=>{t.forEach((e=>{const{placeholder:t,fragment:n}=e;t.parentNode.replaceChild(n,t)})),document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:t.length}})),console.log(`Inserted ${t.length} inline reference(s)`)}))}()}document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll("span.iref-placeholder").length>0&&document.querySelectorAll("dl.terms-and-definitions-list dt.term-external").length>0?document.addEventListener("trefs-inserted",(()=>{insertIrefs()}),{once:!0}):insertIrefs()}));
|
|
115
115
|
function getOrCreateButtonContainer(t){let n=t.querySelector(".definition-buttons-container");return n||(n=document.createElement("div"),n.classList.add("definition-buttons-container"),t.appendChild(n)),n}function addButtonToContainer(t,n,e=!1){const i=getOrCreateButtonContainer(t);return e?i.insertBefore(n,i.firstChild):i.appendChild(n),i}
|
|
116
116
|
function collapseDefinitions(){let{dds:t,dts:e,regularDds:s,specialDds:a}=function(){const t=document.querySelectorAll("#content dl.terms-and-definitions-list > dd");return{dds:t,dts:document.querySelectorAll("#content dl.terms-and-definitions-list > dt"),regularDds:Array.from(t).filter((t=>!i(t.textContent.trim()))),specialDds:Array.from(t).filter((t=>i(t.textContent.trim())))}}();function i(t){return["Source","See also","More in","Also see","See:","See also","See more","See more in","See more about","See more on","See more at","More:","Note:","Paraphrased by","Beware:","eSSIF-Lab: ","W3C VC:","NIST:","Supporting definitions:"].some((e=>t.startsWith(e)))}a.forEach((t=>{t.classList.add("terms-def-extra-info")})),e.forEach((t=>{if(t.querySelector(".collapse-all-defs-button"))return;const e=document.createElement("button");e.classList.add("collapse-all-defs-button","btn-outline-secondary","d-print-none","btn","p-0","fs-5","d-flex","align-items-center","justify-content-center"),e.innerHTML='<span class="state-indicator" data-state="0">①</span><span class="state-indicator" data-state="1">②</span><span class="state-indicator" data-state="2">③</span>',e.setAttribute("id","toggleButton"),e.setAttribute("title","Change how much info is shown"),e.setAttribute("data-state","2"),e.querySelector('.state-indicator[data-state="2"]').classList.add("active"),addButtonToContainer(t,e)})),document.addEventListener("click",(e=>{if(e.target.classList.contains("collapse-all-defs-button")||e.target.classList.contains("state-indicator")){const i=e.target.classList.contains("collapse-all-defs-button")?e.target:e.target.closest(".collapse-all-defs-button"),n=i.getBoundingClientRect();document.documentElement.classList.add("definitions-transitioning"),i.style.position="fixed",i.style.top=`${n.top}px`,i.style.right=window.innerWidth-n.right+"px",i.style.zIndex="1000",function(){const e=document.querySelectorAll(".collapse-all-defs-button");switch((parseInt(e[0].dataset.state||0)+1)%3){case 0:t.forEach((t=>{t.classList.add("hidden"),t.classList.remove("visible")})),e.forEach((t=>{t.dataset.state=0,t.title="Show basic definitions",t.querySelectorAll(".state-indicator").forEach((t=>{0===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.add("defs-hidden");break;case 1:s.forEach((t=>{t.classList.remove("hidden"),t.classList.add("visible")})),a.forEach((t=>{t.classList.add("hidden"),t.classList.remove("visible")})),e.forEach((t=>{t.dataset.state=1,t.title="Show all definitions",t.querySelectorAll(".state-indicator").forEach((t=>{1===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.remove("defs-hidden");break;case 2:t.forEach((t=>{t.classList.remove("hidden"),t.classList.add("visible")})),a.forEach((t=>{t.classList.add("terms-def-extra-info")})),e.forEach((t=>{t.dataset.state=2,t.title="Hide all definitions",t.querySelectorAll(".state-indicator").forEach((t=>{2===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.remove("defs-hidden")}}(),requestAnimationFrame((()=>{i.style.position="",i.style.top="",i.style.right="",i.style.zIndex="",document.documentElement.classList.remove("definitions-transitioning");const t=i.getBoundingClientRect();window.scrollTo({top:window.scrollY+(t.top-n.top),behavior:"instant"})}))}}))}document.addEventListener("DOMContentLoaded",(function(){initializeOnTrefsInserted(collapseDefinitions)}));
|
|
117
117
|
function createToggleButton(e){const t=document.createElement("button");t.classList.add("meta-info-toggle-button","btn","fs-1","d-flex","align-items-center","justify-content-center"),t.innerHTML='<i class="bi bi-info-circle" style="margin-top: -0.5em;"></i>',t.title="Meta info",t.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation();e.classList.contains("collapsed")?(e.classList.remove("collapsed"),e.getBoundingClientRect()):e.classList.add("collapsed")}));let n=e.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?addButtonToContainer(n,t,!0):e.insertBefore(t,e.firstChild)}function collapseMetaInfo(){document.querySelectorAll("dl > dd:has(table)").forEach((function(e){e.classList.add("meta-info-content-wrapper");const t=document.createElement("div");for(t.classList.add("meta-info-inner-wrapper");e.firstChild&&e.firstChild!==e.querySelector(".meta-info-toggle-button");)t.appendChild(e.firstChild);e.querySelector(".meta-info-toggle-button")||createToggleButton(e),e.appendChild(t),e.classList.add("collapsed")}))}document.addEventListener("DOMContentLoaded",(function(){initializeOnTrefsInserted(collapseMetaInfo)}));
|
package/assets/compiled/head.css
CHANGED
|
@@ -9,7 +9,7 @@ code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shad
|
|
|
9
9
|
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}
|
|
10
10
|
#logo img{width:100px}.bi{display:inline-block;width:1.2rem;height:1.2rem}#header,#header *{background-color:var(--header-navbar-bg);color:var(--header-navbar-text)}[data-issue-count]:after{content:"(" attr(data-issue-count) ")";margin:0 0 0 .3em;padding:.1em 0 0}[data-issue-count=""][data-animate]{display:none;opacity:0}[data-issue-count][data-animate]:not([data-issue-count=""]){animation:display-show 1s}#header a:not(#logo),#header a:not(#logo) *,#header button,#header button *{background:#a9dde0}
|
|
11
11
|
.container{min-height:100vh}@media (min-width:768px){.sidebar{position:sticky;top:0;height:100vh;overflow-y:auto;z-index:100}}ul.toc{padding:1em 0 1.75em;font-size:.85em}ul.toc,ul.toc ul{margin:0;padding:0;list-style:none}ul.toc li a{display:block;padding:.4em .8em;text-decoration:none;color:var(--toc-text);transition:background .2s ease,padding-left .2s ease,border-left .2s ease;padding-left:.8em;border-left:3px solid transparent;border-bottom:1px solid rgba(0,0,0,.03)}ul.toc ul{margin-left:1.2em!important;margin-top:.3em}ul.toc a:hover{background:#f9f9f9;padding-left:1em;border-left:3px solid #007bff}ul.toc>li>ul>li>a{padding-left:1.5em}ul.toc>li>ul>li>ul>li>a{padding-left:2em}ul.toc a:focus{outline:2px solid #007bff;outline-offset:-2px;box-shadow:0 0 0 3px rgba(0,123,255,.25);position:relative;z-index:1}.spec-footer{font-size:.7em;text-align:center}ul.toc li a.active,ul.toc li a[aria-current=page]{border-left:3px solid #007bff;font-weight:500;background:#f0f0f0}ul.toc li:last-child a{border-bottom:none}#toc ul li{position:relative}#toc ul li.has-children{position:relative}.collapse-toggle{position:absolute;top:.35em;right:0;width:28px;height:28px;background:0 0;border:1px solid transparent;border-radius:3px;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .2s,border-color .2s;z-index:2}.collapse-toggle:hover{background-color:rgba(0,0,0,.05)}.collapse-toggle:focus{outline:2px solid #007bff;outline-offset:1px;border-color:#007bff;box-shadow:0 0 0 3px rgba(0,123,255,.25)}.collapse-toggle::after{content:"";border-style:solid;border-width:.15em .15em 0 0;display:inline-block;height:.5em;width:.5em;position:relative;transform:rotate(135deg);transition:transform .2s ease}.collapse-toggle.collapsed::after{transform:rotate(45deg)}#toc ul li.has-children>ul{max-height:1000px;overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out;opacity:1}#toc ul li.has-children.collapsed>ul{max-height:0;overflow:hidden;opacity:.6}.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.screen-reader-text:focus{width:auto;height:auto;clip:auto;display:block;padding:15px 23px 14px;background-color:#fff;color:#007bff;z-index:100000;font-size:1em;font-weight:700;text-decoration:none;line-height:normal;box-shadow:0 0 2px 2px rgba(0,0,0,.2)}
|
|
12
|
-
h2,h3,h4,h5,h6{margin-top:1.5em!important}#terminology-section-utility-container{margin:1em auto;width:100%}@media (min-width:576px){#terminology-section-utility-container{position:sticky;top:3.5em;z-index:10}}.toc-anchor{font-size:.875em;color:#73c2df;text-decoration:none;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}dl.terms-and-definitions-list{margin:0;padding:0;position:relative;z-index:1}dl.terms-and-definitions-list>dt{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.5rem 1.25rem;border-radius:.375rem .375rem 0 0;color:var(--card-text);position:relative;line-height:1.5;font-size:1.05em;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;min-height:2.5rem}dl.terms-and-definitions-list>dt>span{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:all .2s ease-in-out}dl.terms-and-definitions-list>dt:focus>span,dl.terms-and-definitions-list>dt:hover>span,dl.terms-and-definitions-list>dt>span:focus,dl.terms-and-definitions-list>dt>span:hover{white-space:normal;overflow:visible;text-overflow:initial;word-wrap:break-word;line-height:1.4}dl.terms-and-definitions-list>dt:active>span,dl.terms-and-definitions-list>dt>span:active{white-space:normal;overflow:visible;text-overflow:initial;word-wrap:break-word;line-height:1.4}dl.terms-and-definitions-list>dt .btn{font-size:1.2em!important}dl.terms-and-definitions-list>dt:hover{background-color:var(--card-hover-bg);transition:background-color .2s ease-in-out}dl.terms-and-definitions-list>dd{margin:0;background-color:var(--card-bg);border:1px solid var(--card-border);border-top:none;padding:.5rem 2rem;color:var(--card-text);width:100%;position:relative}dl.terms-and-definitions-list dd p{margin:0;color:var(--card-text);padding-left:.5rem}dl.terms-and-definitions-list>dd::before{display:none}dl.terms-and-definitions-list dd table{margin:.5em 0;width:100%;border-collapse:collapse}dl.terms-and-definitions-list dd table td,dl.terms-and-definitions-list dd table th{padding:.5em;border:1px solid #ddd}dl.terms-and-definitions-list dd table th{background-color:#f5f5f5}dl>dd:has(table).meta-info-content-wrapper{display:block;font-size:.7em;position:relative;max-height:none;height:auto;overflow:visible;transition:all .3s ease-out}dl>dd:has(table).meta-info-content-wrapper td,dl>dd:has(table).meta-info-content-wrapper th{padding:.3em}dl>dd:has(table).collapsed.meta-info-content-wrapper{max-height:0;height:0;padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;overflow:hidden;transition:all .3s ease-out;line-height:0}dl>dd:has(table).meta-info-content-wrapper>div{display:block;padding:inherit}.meta-info-toggle-button{position:relative;cursor:pointer}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:1rem}dl.terms-and-definitions-list dd.last-dd{border-radius:0 0 .375rem .375rem;border-bottom:1px solid var(--card-border)}html.dense-info dl.terms-and-definitions-list>dt{padding:.1rem 1.25rem;line-height:inherit;font-size:inherit;min-height:auto}html.dense-info dl.terms-and-definitions-list dd+dt{margin-top:.3rem}html.dense-info dl.terms-and-definitions-list>dt::before{display:none}html.dense-info dl.terms-and-definitions-list>dt>span{flex:1 1 auto;min-width:0}.term-external{position:relative}dl.terms-and-definitions-list>dd.term-external,dl.terms-and-definitions-list>dt.term-external{background:#a9dde03b}.term-local{position:relative}dl.terms-and-definitions-list>dd.term-local,dl.terms-and-definitions-list>dt.term-local{background:#f0f8ff}dl.terms-and-definitions-list .term-original-term{font-style:italic}dl.terms-and-definitions-list .term-external-parenthetical-terms{font-weight:400}dl.terms-and-definitions-list .term-local-original-term{font-style:italic}dl.terms-and-definitions-list .term-local-parenthetical-terms{font-weight:400}.btn{font-variant:small-caps;text-transform:uppercase;position:relative;z-index:5}.transclusion-heading{font-size:1.3em;font-weight:700;margin:.2em 0 .2em}dl.terms-and-definitions-list>dd.term-external-embedded{position:relative;padding-left:2.5rem;padding-top:.3rem;padding-bottom:.3rem}dl.terms-and-definitions-list span.term-external::after{content:"";position:absolute;top:50%;transform:translateY(-50%);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-box-arrow-right' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z'/%3E%3Cpath fill-rule='evenodd' d='M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z'/%3E%3C/svg%3E");background-size:contain;background-repeat:no-repeat;background-position:center;width:.8rem;height:.8rem;left:.2rem}dl.terms-and-definitions-list span.term-external{padding-left:1.5rem;display:inline-block}.placeholder-tref{display:none}.no-xref-found-message{background:#f8c481;color:#03365f;margin:0 .5em;padding:0 .8em;border-radius:.25rem;font-size:.8rem;font-variant:small-caps;text-transform:uppercase}.iref-content{margin:1rem 0}dl.iref-definition-list{margin:0;padding:0}dl.iref-definition-list>dt.iref-term{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.5rem
|
|
12
|
+
h2,h3,h4,h5,h6{margin-top:1.5em!important}#terminology-section-utility-container{margin:1em auto;width:100%}@media (min-width:576px){#terminology-section-utility-container{position:sticky;top:3.5em;z-index:10}}.toc-anchor{font-size:.875em;color:#73c2df;text-decoration:none;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}dl.terms-and-definitions-list{margin:0;padding:0;position:relative;z-index:1}dl.terms-and-definitions-list>dt{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.5rem 1.25rem;border-radius:.375rem .375rem 0 0;color:var(--card-text);position:relative;line-height:1.5;font-size:1.05em;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;min-height:2.5rem}dl.terms-and-definitions-list>dt>span{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:all .2s ease-in-out}dl.terms-and-definitions-list>dt:focus>span,dl.terms-and-definitions-list>dt:hover>span,dl.terms-and-definitions-list>dt>span:focus,dl.terms-and-definitions-list>dt>span:hover{white-space:normal;overflow:visible;text-overflow:initial;word-wrap:break-word;line-height:1.4}dl.terms-and-definitions-list>dt:active>span,dl.terms-and-definitions-list>dt>span:active{white-space:normal;overflow:visible;text-overflow:initial;word-wrap:break-word;line-height:1.4}dl.terms-and-definitions-list>dt .btn{font-size:1.2em!important}dl.terms-and-definitions-list>dt:hover{background-color:var(--card-hover-bg);transition:background-color .2s ease-in-out}dl.terms-and-definitions-list>dd{margin:0;background-color:var(--card-bg);border:1px solid var(--card-border);border-top:none;padding:.5rem 2rem;color:var(--card-text);width:100%;position:relative}dl.terms-and-definitions-list dd p{margin:0;color:var(--card-text);padding-left:.5rem}dl.terms-and-definitions-list>dd::before{display:none}dl.terms-and-definitions-list dd table{margin:.5em 0;width:100%;border-collapse:collapse}dl.terms-and-definitions-list dd table td,dl.terms-and-definitions-list dd table th{padding:.5em;border:1px solid #ddd}dl.terms-and-definitions-list dd table th{background-color:#f5f5f5}dl>dd:has(table).meta-info-content-wrapper{display:block;font-size:.7em;position:relative;max-height:none;height:auto;overflow:visible;transition:all .3s ease-out}dl>dd:has(table).meta-info-content-wrapper td,dl>dd:has(table).meta-info-content-wrapper th{padding:.3em}dl>dd:has(table).collapsed.meta-info-content-wrapper{max-height:0;height:0;padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;overflow:hidden;transition:all .3s ease-out;line-height:0}dl>dd:has(table).meta-info-content-wrapper>div{display:block;padding:inherit}.meta-info-toggle-button{position:relative;cursor:pointer}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:1rem}dl.terms-and-definitions-list dd.last-dd{border-radius:0 0 .375rem .375rem;border-bottom:1px solid var(--card-border)}html.dense-info dl.terms-and-definitions-list>dt{padding:.1rem 1.25rem;line-height:inherit;font-size:inherit;min-height:auto}html.dense-info dl.terms-and-definitions-list dd+dt{margin-top:.3rem}html.dense-info dl.terms-and-definitions-list>dt::before{display:none}html.dense-info dl.terms-and-definitions-list>dt>span{flex:1 1 auto;min-width:0}.term-external{position:relative}dl.terms-and-definitions-list>dd.term-external,dl.terms-and-definitions-list>dt.term-external{background:#a9dde03b}.term-local{position:relative}dl.terms-and-definitions-list>dd.term-local,dl.terms-and-definitions-list>dt.term-local{background:#f0f8ff}dl.terms-and-definitions-list .term-original-term{font-style:italic}dl.terms-and-definitions-list .term-external-parenthetical-terms{font-weight:400}dl.terms-and-definitions-list .term-local-original-term{font-style:italic}dl.terms-and-definitions-list .term-local-parenthetical-terms{font-weight:400}.btn{font-variant:small-caps;text-transform:uppercase;position:relative;z-index:5}.transclusion-heading{font-size:1.3em;font-weight:700;margin:.2em 0 .2em}dl.terms-and-definitions-list>dd.term-external-embedded{position:relative;padding-left:2.5rem;padding-top:.3rem;padding-bottom:.3rem}dl.terms-and-definitions-list span.term-external::after{content:"";position:absolute;top:50%;transform:translateY(-50%);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-box-arrow-right' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z'/%3E%3Cpath fill-rule='evenodd' d='M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z'/%3E%3C/svg%3E");background-size:contain;background-repeat:no-repeat;background-position:center;width:.8rem;height:.8rem;left:.2rem}dl.terms-and-definitions-list span.term-external{padding-left:1.5rem;display:inline-block}.placeholder-tref{display:none}.no-xref-found-message{background:#f8c481;color:#03365f;margin:0 .5em;padding:0 .8em;border-radius:.25rem;font-size:.8rem;font-variant:small-caps;text-transform:uppercase}.iref-content{margin:1rem 0}dl.iref-definition-list{margin:0;padding:0}dl.iref-definition-list>dt.iref-term{font-weight:700;margin:0;background-color:var(--card-bg-dt);border:1px solid var(--card-border);padding:.5rem 2.25rem;border-radius:.375rem .375rem 0 0;color:var(--card-text);position:relative;line-height:1.5;font-size:1.05em;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;min-height:2.5rem;opacity:.95}dl.iref-definition-list>dd.iref-definition{margin:0;background-color:var(--card-bg);border:1px solid var(--card-border);border-top:none;padding:.5rem 2rem;color:var(--card-text);width:100%;position:relative;opacity:.95}dl.iref-definition-list>dd.iref-definition+dd.iref-definition{border-top:1px dashed var(--card-border)}dl.iref-definition-list>dd.iref-definition:last-child{border-radius:0 0 .375rem .375rem}dl.iref-definition-list dd.iref-definition p{margin:0;color:var(--card-text);padding-left:.5rem}a.iref-link-to-original{color:inherit;text-decoration:none;display:block;width:100%;transition:opacity .2s ease-in-out}a.iref-link-to-original:hover{opacity:.8;text-decoration:underline}.iref-not-found{margin:.5rem 0;padding:.5rem 1rem;background-color:#fff3cd;border:1px solid #ffc107;border-radius:.375rem;color:#856404}
|
|
13
13
|
.btn{font-size:.7em!important;margin:0 0 0 .5em!important}
|
|
14
14
|
.highlight-matches-search{font-size:1em;outline:3px solid #1d6dae39;outline-offset:5px;transition:outline .3s ease-in-out}.highlight-matches-search.active{outline:3px solid #1d6dae;transition:outline .3s ease-in-out}.highlight-matches-DIF-search{background-color:#1d6dae11}.highlight-matches-ToIP-search{background-color:#a9dde0b0}.highlight-matches-BTC-search{background-color:#f19019a1}.highlight-matches-KERI-search{background-color:#b5d070d5}.highlight-matches-SSI-search{background-color:#ff0}.highlight-matches-GLEIF-search{background-color:#52dac6a6}
|
|
15
15
|
.highlight-cfib41dyhcd99sm{background-color:#1d6dae11}
|
|
@@ -30,5 +30,5 @@ article a[href^="https://"]:not(.btn)::after,article a[href^=http]:not(.btn)::af
|
|
|
30
30
|
#content .figure:has(.scrollHintImage){padding:0;margin:0;width:auto;height:auto}
|
|
31
31
|
.highlight2{padding-left:1em;padding-right:1em;border:1px dashed #71bbe6;background:#a9dde03b}
|
|
32
32
|
#toc ul.toc{counter-reset:toc-section}#toc ul.toc>li{counter-reset:toc-subsection}#toc ul.toc>li>ul>li{counter-reset:toc-subsubsection}#toc ul.toc>li>a::before{counter-increment:toc-section;content:counter(toc-section) ". ";font-weight:700;margin-right:.5em}#toc ul.toc>li>ul>li>a::before{counter-increment:toc-subsection;content:counter(toc-section) "." counter(toc-subsection) " ";font-weight:700;margin-right:.5em}#toc ul.toc>li>ul>li>ul>li>a::before{counter-increment:toc-subsubsection;content:counter(toc-section) "." counter(toc-subsection) "." counter(toc-subsubsection) " ";font-weight:700;margin-right:.5em}main article{counter-reset:main-section}main article h2{counter-reset:main-subsection}main article h3{counter-reset:main-subsubsection}main article h2 .toc-anchor::after{counter-increment:main-section;content:" " counter(main-section) ".";font-weight:700}main article h3 .toc-anchor::after{counter-increment:main-subsection;content:" " counter(main-section) "." counter(main-subsection);font-weight:700}main article h4 .toc-anchor::after{counter-increment:main-subsubsection;content:" " counter(main-section) "." counter(main-subsection) "." counter(main-subsubsection);font-weight:700}main article h5::before,main article h6::before{font-weight:700;margin-right:.5em}@media print{#toc ul.toc>li>a::before,#toc ul.toc>li>ul>li>a::before,#toc ul.toc>li>ul>li>ul>li>a::before,main article h2 .toc-anchor::after,main article h3 .toc-anchor::after,main article h4 .toc-anchor::after{color:#000!important}}
|
|
33
|
-
.term-reference{padding:3px;background-color:#eaf5fb;border-radius:7px;position:relative;padding-left:1.5em;text-decoration:none;box-shadow:inset 0 0 0 1px #a9d9f5;transition:box-shadow .3s ease-in-out}.term-reference:hover{box-shadow:inset 0 0 0 3px #a9d9f5}.term-reference::after{content:"";position:absolute;top:50%;transform:translateY(-50%);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-box-arrow-right' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z'/%3E%3Cpath fill-rule='evenodd' d='M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z'/%3E%3C/svg%3E");background-size:contain;background-repeat:no-repeat;background-position:center;width:.8rem;height:.8rem;left:.2rem}
|
|
33
|
+
.term-reference{padding:3px;background-color:#eaf5fb;border-radius:7px;position:relative;padding-left:1.5em;text-decoration:none;box-shadow:inset 0 0 0 1px #a9d9f5;transition:box-shadow .3s ease-in-out}.term-reference:hover{box-shadow:inset 0 0 0 3px #a9d9f5}.term-reference::after{content:"";position:absolute;top:50%;transform:translateY(-50%);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-box-arrow-right' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z'/%3E%3Cpath fill-rule='evenodd' d='M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z'/%3E%3C/svg%3E");background-size:contain;background-repeat:no-repeat;background-position:center;width:.8rem;height:.8rem;left:.2rem}dt.term-reference::after{left:1rem}
|
|
34
34
|
html{scroll-behavior:smooth;scroll-padding-top:50vh}body:not([hashscroll]) :target{animation:highlight-target 3.5s .25s ease}body:not([hashscroll]) dt:has(:target){animation:highlight-target-parent-dt 3.5s .25s ease}dl.terms-and-definitions-list>.highlight{background-color:#ff0!important;transition:background-color .3s ease-in-out}svg[icon]{width:1.25em;height:1.25em;vertical-align:text-top}@keyframes highlight-target{50%{background-color:#ff0}}@keyframes highlight-target-parent-dt{50%{background-color:#ff0;border:1px solid #00c8ff}}#svg{display:none}main *{overflow-wrap:anywhere;word-break:normal}.table-responsive{overflow-x:auto!important;-webkit-overflow-scrolling:touch;width:100%;max-width:100%}.table-responsive *{overflow-wrap:normal!important;word-break:normal!important;white-space:nowrap!important}dd td img{max-width:30px}.notice{margin:1em 0;padding:.5em .9em .55em .65em;border-left:.5em solid}.notice p{margin:.4em 0 0}.note{background:#e9fbe9;border-color:#52e052}.note .notice-link{display:block;color:#178217}.issue{background:#e9f0fb;border-color:#527fe0}.issue .notice-link:before{display:block;color:#1e4cae}.warning{background:#fbe9e9;border-color:#e05252}.warning .notice-link{display:block;color:#ae1e1e}.example{color:#cebe00;background:#1a1e23;border-left:.5em solid}.example .notice-link{display:block;color:inherit;font-size:1.1em;font-family:Heebo,sans-serif}.example pre[class*=language-]{padding:0;border-radius:0}.todo{background:#fbe4ff;border-color:#9700e2}.todo .notice-link{display:block;color:#6d00a2}.alert-primary{background-color:#f9fcff;border-color:#b2ebf2;color:#00838f}.alert-secondary{background-color:#f5f5f5;border-color:#e0e0e0;color:#616161}.alert-success{background-color:#e8f5e9;border-color:#c8e6c9;color:#388e3c}.alert-danger{background-color:#ffebee;border-color:#ef9a9a;color:#d32f2f}.alert-warning{background-color:#fffde7;border-color:#fff9c4;color:#f9a825}.alert-info{background-color:#e1f5fe;border-color:#b3e5fc;color:#0288d1}.alert-light{background-color:#f9f9f9;border-color:#eee;color:#424242}.alert-dark{background-color:#e0e0e0;border-color:#bdbdbd;color:#212121}.alert a{color:inherit;font-weight:700}.alert-primary a{color:#006064}.alert-success a{color:#2e7d32}.alert-danger a{color:#b71c1c}.alert-warning a{color:#f57f17}.alert-info a{color:#01579b}.alert-dark a{color:#000}[data-bs-theme=dark] .alert-primary{background-color:#004d40;border-color:#00695c;color:#b2dfdb}[data-bs-theme=dark] .alert-secondary{background-color:#424242;border-color:#616161;color:#e0e0e0}[data-bs-theme=dark] .alert-success{background-color:#1b5e20;border-color:#2e7d32;color:#a5d6a7}[data-bs-theme=dark] .alert-danger{background-color:#b71c1c;border-color:#c62828;color:#ef9a9a}[data-bs-theme=dark] .alert-warning{background-color:#f57f17;border-color:#ffb300;color:#ffe082}[data-bs-theme=dark] .alert-info{background-color:#01579b;border-color:#0277bd;color:#81d4fa}[data-bs-theme=dark] .alert-light{background-color:#303030;border-color:#424242;color:#e0e0e0}[data-bs-theme=dark] .alert-dark{background-color:#212121;border-color:#424242;color:#bdbdbd}[data-bs-theme=dark] .alert a{color:inherit;font-weight:700}[data-bs-theme=dark] .alert-primary a{color:#80cbc4}[data-bs-theme=dark] .alert-success a{color:#81c784}[data-bs-theme=dark] .alert-danger a{color:#ef5350}[data-bs-theme=dark] .alert-warning a{color:#ffca28}[data-bs-theme=dark] .alert-info a{color:#4fc3f7}[data-bs-theme=dark] .alert-dark a{color:#9e9e9e}#offcanvasSettings .btn-menu-item{border-radius:unset;width:100%;text-align:left;border:1px solid #dee2e6;background-color:var(--card-bg);color:var(--card-text);padding:10px 15px;margin-bottom:5px;transition:background-color .2s ease}#offcanvasSettings .btn-menu-item:hover{background-color:#e9ecef}
|
package/assets/css/refs.css
CHANGED
|
@@ -374,12 +374,12 @@ dl.iref-definition-list {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
/* Term styling for iref */
|
|
377
|
-
dl.iref-definition-list
|
|
377
|
+
dl.iref-definition-list>dt.iref-term {
|
|
378
378
|
font-weight: 700;
|
|
379
379
|
margin: 0;
|
|
380
380
|
background-color: var(--card-bg-dt);
|
|
381
381
|
border: 1px solid var(--card-border);
|
|
382
|
-
padding: 0.5rem
|
|
382
|
+
padding: 0.5rem 2.25rem;
|
|
383
383
|
border-radius: 0.375rem 0.375rem 0 0;
|
|
384
384
|
color: var(--card-text);
|
|
385
385
|
position: relative;
|
|
@@ -395,7 +395,7 @@ dl.iref-definition-list > dt.iref-term {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
/* Definition styling for iref */
|
|
398
|
-
dl.iref-definition-list
|
|
398
|
+
dl.iref-definition-list>dd.iref-definition {
|
|
399
399
|
margin: 0;
|
|
400
400
|
background-color: var(--card-bg);
|
|
401
401
|
border: 1px solid var(--card-border);
|
|
@@ -409,12 +409,12 @@ dl.iref-definition-list > dd.iref-definition {
|
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
/* Add spacing between consecutive iref dd elements */
|
|
412
|
-
dl.iref-definition-list
|
|
412
|
+
dl.iref-definition-list>dd.iref-definition+dd.iref-definition {
|
|
413
413
|
border-top: 1px dashed var(--card-border);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
/* Last dd in iref gets rounded bottom corners */
|
|
417
|
-
dl.iref-definition-list
|
|
417
|
+
dl.iref-definition-list>dd.iref-definition:last-child {
|
|
418
418
|
border-radius: 0 0 0.375rem 0.375rem;
|
|
419
419
|
}
|
|
420
420
|
|
|
@@ -447,4 +447,4 @@ a.iref-link-to-original:hover {
|
|
|
447
447
|
border: 1px solid #ffc107;
|
|
448
448
|
border-radius: 0.375rem;
|
|
449
449
|
color: #856404;
|
|
450
|
-
}
|
|
450
|
+
}
|
|
@@ -55,10 +55,10 @@ function insertIrefs() {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Find the term in the terms-and-definitions-list by its ID
|
|
58
|
+
// Use getElementById instead of querySelector to avoid issues with special characters
|
|
58
59
|
// The term ID is in the format "term:term-name"
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
);
|
|
60
|
+
const fullTermId = `term:${termId}`;
|
|
61
|
+
const termElement = document.getElementById(fullTermId);
|
|
62
62
|
|
|
63
63
|
if (!termElement) {
|
|
64
64
|
console.warn(`iref: term "${originalTerm}" (id: ${termId}) not found in terms-and-definitions-list`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.2",
|
|
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": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[//]: # (This file, named “terms-and-definitions-intro.md” is mandatory and should not be deleted.)
|
|
1
|
+
[//]: # (This file, named “terms-and-definitions-intro.md” is mandatory and should not be deleted. However, you can safely delete this comment and replace it with text of your choice.)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
const { findExternalSpecByKey } = require('../pipeline/references/external-references-service.js');
|
|
15
15
|
const { lookupXrefTerm } = require('../pipeline/rendering/render-utils.js');
|
|
16
|
-
const { whitespace, htmlComments, contentCleaning, externalReferences } = require('../utils/regex-patterns');
|
|
16
|
+
const { whitespace, htmlComments, contentCleaning, externalReferences, utils } = require('../utils/regex-patterns');
|
|
17
17
|
const Logger = require('../utils/logger.js');
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -111,7 +111,10 @@ function parseDef(globalState, token, primary, currentFile) {
|
|
|
111
111
|
// IDs stay intact - we create an ID for the original term and each alias
|
|
112
112
|
return token.info.args.reduce((acc, syn) => {
|
|
113
113
|
// Generate a unique term ID by normalizing the synonym: replace whitespace with hyphens and convert to lowercase. The ID is used for fragment identifier (hash) in the URL, which in turn can be used for an anchor in a web page.
|
|
114
|
-
|
|
114
|
+
// Apply sanitization to remove special characters that would break CSS selectors
|
|
115
|
+
const normalizedSyn = syn.replace(whitespace.oneOrMore, '-').toLowerCase();
|
|
116
|
+
const sanitizedSyn = utils.sanitizeTermId(normalizedSyn);
|
|
117
|
+
const termId = `term:${sanitizedSyn}`;
|
|
115
118
|
return `<span id="${termId}">${acc}</span>`;
|
|
116
119
|
}, displayText);
|
|
117
120
|
}
|
|
@@ -238,7 +241,10 @@ function parseTref(token) {
|
|
|
238
241
|
|
|
239
242
|
return termsAndAliases.reduce((acc, syn, index) => {
|
|
240
243
|
// Generate a unique term ID by normalizing the synonym: replace whitespace with hyphens and convert to lowercase
|
|
241
|
-
|
|
244
|
+
// Apply sanitization to remove special characters that would break CSS selectors
|
|
245
|
+
const normalizedSyn = syn.replace(whitespace.oneOrMore, '-').toLowerCase();
|
|
246
|
+
const sanitizedSyn = utils.sanitizeTermId(normalizedSyn);
|
|
247
|
+
const termId = `term:${sanitizedSyn}`;
|
|
242
248
|
// Add title attribute to the innermost span (first in the array, which wraps the display text directly)
|
|
243
249
|
// This provides a tooltip showing which external term this alias refers to
|
|
244
250
|
const titleAttr = index === 0 && aliases.length > 0 ? ` title="Externally defined as ${termName}"` : '';
|
|
@@ -466,6 +466,28 @@ const utils = {
|
|
|
466
466
|
createGitignoreRegex: function(globPattern) {
|
|
467
467
|
const pattern = '^' + globPattern.replace(/\*/g, '.*').replace(/\//g, '\\/') + '$';
|
|
468
468
|
return new RegExp(pattern);
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Sanitizes a string for use as a valid CSS selector ID
|
|
473
|
+
* Removes special characters that would break querySelector while preserving readability
|
|
474
|
+
*
|
|
475
|
+
* Keeps: letters, numbers, hyphens, underscores, colons
|
|
476
|
+
* Removes: parentheses, brackets, slashes, and other special characters
|
|
477
|
+
*
|
|
478
|
+
* @param {string} str - String to sanitize
|
|
479
|
+
* @returns {string} Sanitized string safe for use in CSS selectors
|
|
480
|
+
*
|
|
481
|
+
* Example:
|
|
482
|
+
* sanitizeTermId("authentic chained data container (ACDC)")
|
|
483
|
+
* → "authentic-chained-data-container-acdc"
|
|
484
|
+
* sanitizeTermId("term/with/slashes") → "term-with-slashes"
|
|
485
|
+
*/
|
|
486
|
+
sanitizeTermId: function(str) {
|
|
487
|
+
return str
|
|
488
|
+
.replace(/[()[\]{}\/\\]/g, '-') // Replace special chars with hyphens
|
|
489
|
+
.replace(/-+/g, '-') // Collapse multiple hyphens into one
|
|
490
|
+
.replace(/^-|-$/g, ''); // Remove leading/trailing hyphens
|
|
469
491
|
}
|
|
470
492
|
};
|
|
471
493
|
|