spec-up-t 1.1.45 → 1.1.47
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 +0 -27
- package/assets/compiled/head.css +1 -1
- package/assets/css/terms-and-definitions.css +3 -0
- package/index.js +16 -4
- package/package.json +1 -1
- package/src/asset-map.json +0 -1
- package/src/prepare-tref.js +29 -2
package/assets/compiled/body.js
CHANGED
|
@@ -99,33 +99,6 @@ function createAlphabetIndex(){const e=document.getElementById("terminology-sect
|
|
|
99
99
|
function inPageSearch(){const t=document.getElementById("terminology-section-utility-container"),e=specConfig.searchHighlightStyle||"ssi",n="search-h7vc6omi2hr2880",i=document.querySelector(".terms-and-definitions-list"),o=document.createElement("div");o.setAttribute("id","container-"+n),o.classList.add("input-group","mb-3","d-flex","align-items-center"),o.setAttribute("role","search"),t.appendChild(o);const s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("id",n),s.classList.add("form-control"),s.setAttribute("placeholder","🔍"),s.setAttribute("aria-label","Search terms"),s.setAttribute("autocomplete","off"),o.appendChild(s);const c=document.createElement("div");c.classList.add("input-group-append");const a=document.createElement("button");a.setAttribute("id","one-match-backward-"+n),a.classList.add("btn","btn-outline-secondary"),a.setAttribute("type","button"),a.setAttribute("disabled","true"),a.setAttribute("title","Go to previous match (Left Arrow)"),a.setAttribute("aria-label","Go to previous match"),a.innerHTML='<span aria-hidden="true">▲</span>',c.appendChild(a);const r=document.createElement("button");r.setAttribute("id","one-match-forward-"+n),r.classList.add("btn","btn-outline-secondary"),r.setAttribute("type","button"),r.setAttribute("disabled","true"),r.setAttribute("title","Go to next match (Right Arrow)"),r.setAttribute("aria-label","Go to next match"),r.innerHTML='<span aria-hidden="true">▼</span>',c.appendChild(r);const d=document.createElement("span");d.setAttribute("id","total-matches-"+n),d.classList.add("input-group-text"),d.innerHTML="0 matches",d.setAttribute("aria-live","polite"),d.setAttribute("role","status"),o.appendChild(d),o.appendChild(c),s.addEventListener("input",(function(){f(s.value)})),document.addEventListener("click",t=>{t.target.classList.contains("collapse-all-defs-button")&&f(s.value)});const l="highlight-matches-"+n,u={dif:"highlight-matches-DIF-search-h7vc6omi2hr2880",toip:"highlight-matches-ToIP-search-h7vc6omi2hr2880",btc:"highlight-matches-BTC-search-h7vc6omi2hr2880",keri:"highlight-matches-KERI-search-h7vc6omi2hr2880",ssi:"highlight-matches-SSI-search-h7vc6omi2hr2880",gleif:"highlight-matches-GLEIF-search-h7vc6omi2hr2880"}[e.toLowerCase()];let h=0,m=-1;function p(t){t.scrollIntoView({behavior:"smooth",block:"start"});const e=t.getBoundingClientRect(),n=e.top+window.pageYOffset-(window.innerHeight-e.height)/2;window.scrollTo({top:n,behavior:"smooth"})}function b(){m<=0?document.getElementById("one-match-backward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-backward-"+n).removeAttribute("disabled"),m>=h-1?document.getElementById("one-match-forward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-forward-"+n).removeAttribute("disabled")}function g(){d.innerHTML=h+" matches"}const f=function(t,e){let n;return function(){const i=this,o=arguments;clearTimeout(n),n=setTimeout(()=>t.apply(i,o),e)}}((function(t){void document.querySelectorAll("span."+l).forEach(t=>{Array.from(t.childNodes).forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&t.removeChild(e)}),t.classList.contains(l)&&(t.outerHTML=t.innerHTML)}),h=0,m=-1,t.length>=2&&('"'===t[0]&&'"'===t[t.length-1]||"'"===t[0]&&"'"===t[t.length-1])&&(t=t.substring(1,t.length-1));if(""===t)return void g();let e=0;!function i(o){if(3!==o.nodeType||function(t){for(;t;){if(t.classList&&t.classList.contains("hidden"))return!0;t=t.parentNode}return!1}(o))1===o.nodeType&&Array.from(o.childNodes).forEach(i);else{const i=function(i){const o=i.nodeValue,s=new RegExp(t,"gi");let c,a=0,r=document.createDocumentFragment();for(;null!==(c=s.exec(o));){r.appendChild(document.createTextNode(o.substring(a,c.index)));const t=document.createElement("span");t.textContent=c[0],t.classList.add(l),t.classList.add(u),t.setAttribute("id",n+"-"+e),r.appendChild(t),h=e+1,e++,a=c.index+c[0].length}return r.appendChild(document.createTextNode(o.substring(a))),r}(o);i.childNodes.length>1&&o.parentNode.replaceChild(i,o)}}(i);let o=document.querySelector("."+u);null!==o&&p(o);g(),b(),m=-1}),600);a.addEventListener("click",(function(){m--;const t=document.querySelector("#"+n+"-"+m);t&&p(t),t.classList.add("active"),setTimeout(()=>{t.classList.remove("active")},3e3),b()})),r.addEventListener("click",(function(){m++;const t=document.querySelector("#"+n+"-"+m);t&&p(t),t.classList.add("active"),setTimeout(()=>{t.classList.remove("active")},3e3),b()})),document.addEventListener("keyup",t=>{switch(t.key){case"ArrowRight":r.click();break;case"ArrowLeft":a.click()}})}document.addEventListener("DOMContentLoaded",(function(){inPageSearch()}));
|
|
100
100
|
function highlightMenuItems(){let t=null;function e(t){document.querySelectorAll("#toc_list a").forEach(t=>{t.classList.remove("highlight-cfib41dyhcd99sm")});const e=document.querySelector(`#toc_list a[href="#${t.id}"]`);e&&(e.classList.add("highlight-cfib41dyhcd99sm"),e.scrollIntoView({behavior:"smooth",block:"center"}))}const o=new IntersectionObserver((o,n)=>{const c=o.filter(t=>t.isIntersecting).map(t=>t.target);c.length>0?(t=c[0],e(t)):t&&e(t)},{root:null,rootMargin:"0px",threshold:.1});document.querySelectorAll("h2, h3, h4, h5, h6").forEach(t=>o.observe(t))}document.addEventListener("DOMContentLoaded",(function(){highlightMenuItems()}));
|
|
101
101
|
function backToTop(){const n=document.createElement("a");n.id="back-to-top-a1zncgtqfpzsig8",n.href="#content",n.innerHTML="↑",document.body.appendChild(n);const t=function(n,t){let e;return function(){const o=this,c=arguments;clearTimeout(e),e=setTimeout(()=>n.apply(o,c),t)}}((function(){window.scrollY>300?n.style.display="flex":n.style.display="none"}),600);window.addEventListener("scroll",(function(){t()}))}document.addEventListener("DOMContentLoaded",(function(){backToTop()}));
|
|
102
|
-
/**
|
|
103
|
-
* @file This file fetches and displays commit hashes by matching elements with `x-term-reference` class against the `allXTrefs` global object.
|
|
104
|
-
* Example:
|
|
105
|
-
* const allXTrefs = {
|
|
106
|
-
"xtrefs": [
|
|
107
|
-
{
|
|
108
|
-
"externalSpec": "test-1",
|
|
109
|
-
"term": "Aal",
|
|
110
|
-
"repoUrl": "https://github.com/blockchainbird/spec-up-xref-test-1",
|
|
111
|
-
"terms_dir": "spec/term-definitions",
|
|
112
|
-
"owner": "blockchainbird",
|
|
113
|
-
"repo": "spec-up-xref-test-1",
|
|
114
|
-
"site": "https://blockchainbird.github.io/spec-up-xref-test-1/",
|
|
115
|
-
"commitHash": [
|
|
116
|
-
"f66951f1d378490289caab9c51141b44a0438365",
|
|
117
|
-
"content": "[[def: AAL]]:\n\n~ See: [[ref: authenticator assurance level]].\n\n~ This is an addition, for testing purposes.\n"
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
{…}
|
|
121
|
-
]
|
|
122
|
-
};
|
|
123
|
-
* @author Kor Dwarshuis
|
|
124
|
-
* @version 0.0.1
|
|
125
|
-
* @license MIT
|
|
126
|
-
* @since 2024-06-09
|
|
127
|
-
*/
|
|
128
|
-
var md=window.markdownit();function fetchCommitHashes(){async function e(e,r){const i=document.createElement("div");i.classList.add("fetched-xref-term"),i.classList.add("transcluded-xref-term"),i.innerHTML="<p class='loadertext'>Loading external reference</p><div class='loader'></div>",r.parentNode.insertBefore(i,r.nextSibling);const s=async function(e,t){const r={};e&&e.length>0&&(r.Authorization="token "+e);try{const e=await fetch("https://api.github.com/repos/"+t.owner+"/"+t.repo+"/contents/"+t.terms_dir+"/"+t.term.replace(/ /g,"-").toLowerCase()+".md",{headers:r});if(403===e.status&&"0"===e.headers.get("X-RateLimit-Remaining")){const t=new Date(1e3*e.headers.get("X-RateLimit-Reset"));return console.error(`❌ Github API rate limit exceeded. Try again after ${t}. See https://blockchainbird.github.io/spec-up-t-website/docs/getting-started/github-token for more info.`),o(),!0}console.log(`ℹ️ Github API rate limit: ${e.headers.get("X-RateLimit-Remaining")} requests remaining. See https://blockchainbird.github.io/spec-up-t-website/docs/getting-started/github-token for more info.`);const s=await e.json(),a=atob(s.content);return i=(i=a).replace(/\[\[def: ([^\]]+)\]\]/g,""),n.render(i)}catch(e){console.error("Error fetching content:",e)}var i}(t,e),a=new Promise(e=>setTimeout(e,2e3)),[c]=await Promise.all([s,a]),d=Date.now(),l=new Date(d).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});i.innerHTML="<p class='transclusion-heading'>Current definition</p><small>"+l+"</small>"+c}if("undefined"==typeof allXTrefs||null===allXTrefs)return void console.log("allXTrefs is not defined or does not exist. We will continue without it.");const t=localStorage.getItem("githubToken"),n=window.markdownit().use(window.markdownitDeflist);const o=function(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e.apply(this,o),t)}}(()=>{notyf.error('GitHub API rate limit exceeded. See <a target="_blank" rel="noopener" href="https://blockchainbird.github.io/spec-up-t-website/docs/getting-started/github-token">documentation</a> for more info.')},3e3);document.querySelectorAll(".x-term-reference").forEach(r=>{const i=r.getAttribute("data-local-href").split(":");allXTrefs.xtrefs.forEach(s=>{if(s.externalSpec===i[1]&&s.term.toLowerCase()===i[2].toLowerCase()){if(!s.commitHash){const e=document.createElement("span");return e.classList.add("no-xref-found-message"),e.innerHTML="No xref found.",void r.parentNode.insertBefore(e,r.nextSibling)}s.commitHash&&s.commitHash&&s.commitHash.substring(0,7);const i=document.createElement("a");i.href="https://github.com/"+s.owner+"/"+s.repo+"/compare/"+s.commitHash+"../main",i.target="_blank",i.rel="noopener noreferrer",i.classList.add("diff","xref-info-links","btn"),i.innerHTML='<svg icon><use xlink:href="#svg-github"></use></svg> Xref < > <svg icon><use xlink:href="#svg-github"></use></svg> Now',i.title="A Diff between the current commit hash of the definition and the commit hash referenced when the link was created.",r.parentNode.insertBefore(i,r.nextSibling);const a=document.createElement("a");a.href="https://github.com/"+s.owner+"/"+s.repo+"/blob/main/"+s.terms_dir+"/"+s.term.replace(/ /g,"-").toLowerCase()+".md",a.target="_blank",a.rel="noopener noreferrer",a.classList.add("latest-version","xref-info-links","btn"),a.innerHTML='<svg icon><use xlink:href="#svg-github"></use></svg> Now',a.title="Go to the repo page of the definition‘s latest version.",i.parentNode.insertBefore(a,r.nextSibling);const c=document.createElement("a");c.href="https://github.com/"+s.owner+"/"+s.repo+"/blob/"+s.commitHash+"/"+s.terms_dir+"/"+s.term.replace(/ /g,"-").toLowerCase()+".md",c.target="_blank",c.rel="noopener noreferrer",c.classList.add("exact-commit-hash","xref-info-links","btn"),c.innerHTML='<svg icon><use xlink:href="#svg-github"></use></svg> Xref',c.title="Go to the repo page of the definition‘s version referenced when the link was created.",a.parentNode.insertBefore(c,r.nextSibling);const d=document.createElement("button");d.classList.add("show-diff-modal","xref-info-links","btn"),d.innerHTML='Xref < > <svg icon><use xlink:href="#svg-github"></use></svg> Now',d.title="Show diff between the latest version and the referenced version",a.parentNode.insertBefore(d,r.nextSibling),d.addEventListener("click",(function(e){e.preventDefault(),function(e,t){const n={};e&&e.length>0&&(n.Authorization="token "+e),fetch("https://api.github.com/repos/"+t.owner+"/"+t.repo+"/contents/"+t.terms_dir+"/"+t.term.replace(/ /g,"-").toLowerCase()+".md",{headers:n}).then(e=>{if(403===e.status&&"0"===e.headers.get("X-RateLimit-Remaining")){const t=new Date(1e3*e.headers.get("X-RateLimit-Reset"));return console.error(`❌ Github API rate limit exceeded. Try again after ${t}. See https://blockchainbird.github.io/spec-up-t-website/docs/getting-started/github-token for more info.`),o(),!0}return console.log(`ℹ️ Github API rate limit: ${e.headers.get("X-RateLimit-Remaining")} requests remaining. See https://blockchainbird.github.io/spec-up-t-website/docs/getting-started/github-token for more info.`),e.json()}).then(e=>{const n=atob(e.content),o=Diff.diffChars(t.content,n),r=document.createDocumentFragment();o.forEach(e=>{const t=e.added?"green":e.removed?"red":"grey",n=e.added||e.removed?"#ddd":"white";span=document.createElement("span"),span.style.color=t,span.style.backgroundColor=n,span.appendChild(document.createTextNode(e.value)),r.appendChild(span)});const i=document.createElement("div");i.innerHTML="<h1>Diff xref (local snapshot) and latest version</h1>",i.appendChild(r),i.innerHTML=i.innerHTML.replace(/\n/g,"<br>"),showModal(i.innerHTML)}).catch(e=>{console.error("Error fetching content:",e)})}(t,s)}));const l=document.createElement("button");l.classList.add("show-diff-modal","xref-info-links","btn"),l.innerHTML="Xref",l.title="Show the stored version of the term-file",d.parentNode.insertBefore(l,r.nextSibling);const h=/\[\[def: ([^\]]+)\]\]/g;s.content=s.content.replace(h,"");const m=n.render(s.content);l.addEventListener("click",(function(e){e.preventDefault(),showModal(`\n <h1>Term definition (local snapshot)</h1>\n <table>\n <tr>\n <th>Commit hash</th>\n <td>${s.commitHash}</td>\n </tr>\n <tr>\n <th>Content</th>\n <td>${m}</td>\n </tr>\n </table>\n `)}));const f=document.createElement("div");f.classList.add("local-snapshot-xref-term"),f.classList.add("transcluded-xref-term"),f.innerHTML=`<p class='transclusion-heading'>Snapshot</p><p>Commit Hash: ${s.commitHash}</p> ${m}`,r.parentNode.insertBefore(f,r.nextSibling),e(s,r)}})})}document.addEventListener("DOMContentLoaded",(function(){fetchCommitHashes()}));
|
|
129
102
|
function addAnchorsToTerms(){document.querySelectorAll('dt:has(> span[id^="term:"])').forEach(e=>{const t=function(e){let t=e;for(;t.querySelector('span[id^="term:"]');)t=t.querySelector('span[id^="term:"]');return t}(e),r=t.getAttribute("id"),n=document.createElement("a");n.setAttribute("href","#"+r),n.setAttribute("class","toc-anchor"),n.innerHTML="# ",t.parentNode.insertBefore(n,t)})}document.addEventListener("DOMContentLoaded",(function(){addAnchorsToTerms()}));
|
|
130
103
|
function copyAnchorToCliboard(){document.addEventListener("click",(function(o){if(o.target.classList.contains("toc-anchor")){const c=o.target.href;navigator.clipboard.writeText(c).then(()=>{console.log("Anchor copied to clipboard"),notyf.success("Anchor copied to clipboard: "+c)}).catch(o=>{console.error("Failed to copy anchor to clipboard",o)})}}))}document.addEventListener("DOMContentLoaded",(function(){copyAnchorToCliboard()}));
|
|
131
104
|
var Notyf=function(){"use strict";var t,i=function(){return(i=Object.assign||function(t){for(var i,e=1,n=arguments.length;e<n;e++)for(var o in i=arguments[e])Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o]);return t}).apply(this,arguments)},e=(n.prototype.on=function(t,i){var e=this.listeners[t]||[];this.listeners[t]=e.concat([i])},n.prototype.triggerEvent=function(t,i){var e=this;(this.listeners[t]||[]).forEach((function(t){return t({target:e,event:i})}))},n);function n(t){this.options=t,this.listeners={}}(s=t=t||{})[s.Add=0]="Add",s[s.Remove=1]="Remove";var o,s,a=(r.prototype.push=function(i){this.notifications.push(i),this.updateFn(i,t.Add,this.notifications)},r.prototype.splice=function(i,e){return e=this.notifications.splice(i,e)[0],this.updateFn(e,t.Remove,this.notifications),e},r.prototype.indexOf=function(t){return this.notifications.indexOf(t)},r.prototype.onUpdate=function(t){this.updateFn=t},r);function r(){this.notifications=[]}(s=o=o||{}).Dismiss="dismiss";var c={types:[{type:"success",className:"notyf__toast--success",backgroundColor:"#3dc763",icon:{className:"notyf__icon--success",tagName:"i"}},{type:"error",className:"notyf__toast--error",backgroundColor:"#ed3d3d",icon:{className:"notyf__icon--error",tagName:"i"}}],duration:2e3,ripple:!0,position:{x:"right",y:"bottom"},dismissible:!(s.Click="click")},p=(d.prototype.on=function(t,e){var n;this.events=i(i({},this.events),((n={})[t]=e,n))},d.prototype.update=function(i,e){e===t.Add?this.addNotification(i):e===t.Remove&&this.removeNotification(i)},d.prototype.removeNotification=function(t){var i,e,n=this;(t=this._popRenderedNotification(t))&&((e=t.node).classList.add("notyf__toast--disappear"),e.addEventListener(this.animationEndEventName,i=function(t){t.target===e&&(e.removeEventListener(n.animationEndEventName,i),n.container.removeChild(e))}))},d.prototype.addNotification=function(t){var i=this._renderNotification(t);this.notifications.push({notification:t,node:i}),this._announce(t.options.message||"Notification")},d.prototype._renderNotification=function(t){var i=this._buildNotificationCard(t),e=t.options.className;return e&&(t=i.classList).add.apply(t,e.split(" ")),this.container.appendChild(i),i},d.prototype._popRenderedNotification=function(t){for(var i=-1,e=0;e<this.notifications.length&&i<0;e++)this.notifications[e].notification===t&&(i=e);if(-1!==i)return this.notifications.splice(i,1)[0]},d.prototype.getXPosition=function(t){return(null===(t=null==t?void 0:t.position)||void 0===t?void 0:t.x)||"right"},d.prototype.getYPosition=function(t){return(null===(t=null==t?void 0:t.position)||void 0===t?void 0:t.y)||"bottom"},d.prototype.adjustContainerAlignment=function(t){var i=this.X_POSITION_FLEX_MAP[this.getXPosition(t)],e=this.Y_POSITION_FLEX_MAP[this.getYPosition(t)];(t=this.container.style).setProperty("justify-content",e),t.setProperty("align-items",i)},d.prototype._buildNotificationCard=function(t){var i=this,e=t.options,n=e.icon;this.adjustContainerAlignment(e);var s=this._createHTMLElement({tagName:"div",className:"notyf__toast"}),a=this._createHTMLElement({tagName:"div",className:"notyf__ripple"}),r=this._createHTMLElement({tagName:"div",className:"notyf__wrapper"}),c=this._createHTMLElement({tagName:"div",className:"notyf__message"});c.innerHTML=e.message||"";var p,d,l,u,f=e.background||e.backgroundColor;return n&&(p=this._createHTMLElement({tagName:"div",className:"notyf__icon"}),("string"==typeof n||n instanceof String)&&(p.innerHTML=new String(n).valueOf()),"object"==typeof n&&(d=n.tagName,l=n.className,u=n.text,n=void 0===(n=n.color)?f:n,u=this._createHTMLElement({tagName:void 0===d?"i":d,className:l,text:u}),n&&(u.style.color=n),p.appendChild(u)),r.appendChild(p)),r.appendChild(c),s.appendChild(r),f&&(e.ripple?(a.style.background=f,s.appendChild(a)):s.style.background=f),e.dismissible&&(a=this._createHTMLElement({tagName:"div",className:"notyf__dismiss"}),f=this._createHTMLElement({tagName:"button",className:"notyf__dismiss-btn"}),a.appendChild(f),r.appendChild(a),s.classList.add("notyf__toast--dismissible"),f.addEventListener("click",(function(e){var n,s;null!==(s=(n=i.events)[o.Dismiss])&&void 0!==s&&s.call(n,{target:t,event:e}),e.stopPropagation()}))),s.addEventListener("click",(function(e){var n,s;return null===(s=(n=i.events)[o.Click])||void 0===s?void 0:s.call(n,{target:t,event:e})})),e="top"===this.getYPosition(e)?"upper":"lower",s.classList.add("notyf__toast--"+e),s},d.prototype._createHTMLElement=function(t){var i=t.tagName,e=t.className;t=t.text,i=document.createElement(i);return e&&(i.className=e),i.textContent=t||null,i},d.prototype._createA11yContainer=function(){var t=this._createHTMLElement({tagName:"div",className:"notyf-announcer"});t.setAttribute("aria-atomic","true"),t.setAttribute("aria-live","polite"),t.style.border="0",t.style.clip="rect(0 0 0 0)",t.style.height="1px",t.style.margin="-1px",t.style.overflow="hidden",t.style.padding="0",t.style.position="absolute",t.style.width="1px",t.style.outline="0",document.body.appendChild(t),this.a11yContainer=t},d.prototype._announce=function(t){var i=this;this.a11yContainer.textContent="",setTimeout((function(){i.a11yContainer.textContent=t}),100)},d.prototype._getAnimationEndEventName=function(){var t,i=document.createElement("_fake"),e={MozTransition:"animationend",OTransition:"oAnimationEnd",WebkitTransition:"webkitAnimationEnd",transition:"animationend"};for(t in e)if(void 0!==i.style[t])return e[t];return"animationend"},d);function d(){this.notifications=[],this.events={},this.X_POSITION_FLEX_MAP={left:"flex-start",center:"center",right:"flex-end"},this.Y_POSITION_FLEX_MAP={top:"flex-start",center:"center",bottom:"flex-end"};var t=document.createDocumentFragment(),i=this._createHTMLElement({tagName:"div",className:"notyf"});t.appendChild(i),document.body.appendChild(t),this.container=i,this.animationEndEventName=this._getAnimationEndEventName(),this._createA11yContainer()}function l(t){var e=this;this.dismiss=this._removeNotification,this.notifications=new a,this.view=new p;var n=this.registerTypes(t);this.options=i(i({},c),t),this.options.types=n,this.notifications.onUpdate((function(t,i){return e.view.update(t,i)})),this.view.on(o.Dismiss,(function(t){var i=t.target;t=t.event;e._removeNotification(i),i.triggerEvent(o.Dismiss,t)})),this.view.on(o.Click,(function(t){var i=t.target;t=t.event;return i.triggerEvent(o.Click,t)}))}return l.prototype.error=function(t){return t=this.normalizeOptions("error",t),this.open(t)},l.prototype.success=function(t){return t=this.normalizeOptions("success",t),this.open(t)},l.prototype.open=function(t){var n=this.options.types.find((function(i){return i.type===t.type}))||{};n=i(i({},n),t);return this.assignProps(["ripple","position","dismissible"],n),n=new e(n),this._pushNotification(n),n},l.prototype.dismissAll=function(){for(;this.notifications.splice(0,1););},l.prototype.assignProps=function(t,i){var e=this;t.forEach((function(t){i[t]=(null==i[t]?e.options:i)[t]}))},l.prototype._pushNotification=function(t){var i=this;this.notifications.push(t);var e=(void 0!==t.options.duration?t:this).options.duration;e&&setTimeout((function(){return i._removeNotification(t)}),e)},l.prototype._removeNotification=function(t){-1!==(t=this.notifications.indexOf(t))&&this.notifications.splice(t,1)},l.prototype.normalizeOptions=function(t,e){return t={type:t},"string"==typeof e?t.message=e:"object"==typeof e&&(t=i(i({},t),e)),t},l.prototype.registerTypes=function(t){var e=(t&&t.types||[]).slice();return c.types.map((function(t){var n=-1;e.forEach((function(i,e){i.type===t.type&&(n=e)}));var o=-1!==n?e.splice(n,1)[0]:{};return i(i({},t),o)})).concat(e)},l}(),notyf=new Notyf({types:[{type:"success",background:"#1D6DAE",duration:3e3},{type:"error",background:"orange",duration:1e7,dismissible:!0}]});
|
package/assets/compiled/head.css
CHANGED
|
@@ -12,7 +12,7 @@ dl>dd:has(table).meta-info-content-wrapper{max-height:10em;transition:max-height
|
|
|
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}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}
|
|
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}.placeholder-tref{display:none}.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
|
package/index.js
CHANGED
|
@@ -49,10 +49,16 @@ module.exports = async function (options = {}) {
|
|
|
49
49
|
const replacers = [
|
|
50
50
|
{
|
|
51
51
|
test: 'insert',
|
|
52
|
-
transform: function (path) {
|
|
52
|
+
transform: function (originalMatch, type, path) {
|
|
53
53
|
if (!path) return '';
|
|
54
54
|
return fs.readFileSync(path, 'utf8');
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
test: 'tref',
|
|
59
|
+
transform: function (originalMatch, type, spec, term) {
|
|
60
|
+
return `${originalMatch}\n: <span class="placeholder-tref">No custom content found for ${spec}:${term}</span> { .placeholder-dd }\n`;
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
];
|
|
58
64
|
|
|
@@ -78,10 +84,13 @@ module.exports = async function (options = {}) {
|
|
|
78
84
|
function applyReplacers(doc) {
|
|
79
85
|
return doc.replace(replacerRegex, function (match, type, args) {
|
|
80
86
|
let replacer = replacers.find(r => type.trim().match(r.test));
|
|
81
|
-
|
|
87
|
+
if (replacer) {
|
|
88
|
+
let argsArray = args ? args.trim().split(replacerArgsRegex) : [];
|
|
89
|
+
return replacer.transform(match, type, ...argsArray);
|
|
90
|
+
}
|
|
91
|
+
return match;
|
|
82
92
|
});
|
|
83
93
|
}
|
|
84
|
-
|
|
85
94
|
function normalizePath(path) {
|
|
86
95
|
return path.trim().replace(/\/$/g, '') + '/';
|
|
87
96
|
}
|
|
@@ -155,7 +164,10 @@ module.exports = async function (options = {}) {
|
|
|
155
164
|
}, primary);
|
|
156
165
|
}
|
|
157
166
|
else if (type === 'xref') {
|
|
158
|
-
|
|
167
|
+
// Get the URL for the external specification reference, or default to '#' if not found
|
|
168
|
+
const externalSpec = findExternalSpecByKey(config, token.info.args[0]);
|
|
169
|
+
const url = externalSpec?.gh_page || '#';
|
|
170
|
+
|
|
159
171
|
const term = token.info.args[1].replace(spaceRegex, '-').toLowerCase();
|
|
160
172
|
return `<a class="x-term-reference term-reference" data-local-href="#term:${token.info.args[0]}:${term}"
|
|
161
173
|
href="${url}#term:${term}">${token.info.args[1]}</a>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
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,3 +1,24 @@
|
|
|
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
|
+
|
|
1
22
|
const fs = require('fs');
|
|
2
23
|
const path = require('path');
|
|
3
24
|
const dedent = require('dedent');
|
|
@@ -47,8 +68,7 @@ function prepareTref(directory) {
|
|
|
47
68
|
|
|
48
69
|
// Variable to store content after the span or tref line
|
|
49
70
|
let contentAfterSpan = '';
|
|
50
|
-
|
|
51
|
-
const spanMarker = '- - -';
|
|
71
|
+
const spanMarker = '<span style="display: none;">End of included external content. Add your optional custom content below.</span>';
|
|
52
72
|
const spanIndex = data.indexOf(spanMarker);
|
|
53
73
|
|
|
54
74
|
if (spanIndex !== -1) {
|
|
@@ -81,9 +101,16 @@ function prepareTref(directory) {
|
|
|
81
101
|
|
|
82
102
|
const readyForWrite = dedent`
|
|
83
103
|
${match[0]}
|
|
104
|
+
| Property | Value |
|
|
105
|
+
| -------- | ----- |
|
|
106
|
+
| Owner |  ${localXTrefContent.owner} |
|
|
107
|
+
| Repo | [${localXTrefContent.repo}](${localXTrefContent.repoUrl}) |
|
|
108
|
+
| Commit hash | ${localXTrefContent.commitHash} |
|
|
84
109
|
|
|
110
|
+
${localXTrefContent.content}
|
|
85
111
|
${spanMarker}
|
|
86
112
|
|
|
113
|
+
${contentAfterSpan}
|
|
87
114
|
|
|
88
115
|
`;
|
|
89
116
|
|