spec-up-t 1.0.81 → 1.0.82
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 +14 -6
- package/assets/compiled/head.css +1 -1
- package/assets/css/index.css +44 -2
- package/assets/js/css-helper.js +30 -0
- package/assets/js/show-commit-hashes.js +113 -21
- package/index.js +22 -15
- package/package.json +1 -1
- package/src/asset-map.json +3 -1
- package/src/create-pdf.js +28 -0
- package/src/fix-markdown-files.js +1 -1
- package/src/{get-xrefs-data.js → get-xtrefs-data.js} +61 -61
- package/src/prepare-tref.js +96 -0
- package/templates/template.html +1 -1
package/assets/compiled/head.css
CHANGED
|
@@ -11,4 +11,4 @@ code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-fami
|
|
|
11
11
|
.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}.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)}.modal-close{position:absolute;top:0;right:5px;background-color:transparent;border:none;font-size:2rem;line-height:1;cursor:pointer}
|
|
12
12
|
.alphabet-index{display:flex;flex-wrap:wrap;justify-content:center;margin:1em auto;padding:0;width:100%}.alphabet-index a{background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:50%;color:#333;display:block;font-size:1rem;height:33.33px;line-height:33.33px;margin:3.33px;text-align:center;text-decoration:none;width:33.33px}.number-of-terms{text-align:center}
|
|
13
13
|
.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)}
|
|
14
|
-
:root{--base-theme-color:207,71%;--themed-element-bk:hsl(var(--base-theme-color), 40%);--themed-element-text:#fff;--themed-element-border:1px solid hsl(var(--base-theme-color), 26%);--themed-heading-text:hsl(var(--base-theme-color), 30%);--no-color:255,255,255;--faint-color:245,245,245;--dim-color:225,225,225;--low-color:200,200,200;--mid-color:100,100,100;--high-color:50,50,50;--full-color:0,0,0;--active-color:#3aaaff;--visited-color:rgb(188, 129, 255);--green-status:rgb(0, 123, 9);--light-green-status:rgb(0, 194, 13);--page-bk:rgb(var(--no-color));--page-text:rgb(var(--full-color));--page-text-hover:rgb(var(--full-color));--element-bk:rgb(var(--no-color));--element-bk-hover:rgba(var(--low-color), 0.5);--element-bk-transparent:rgba(var(--dim-color), 0.92);--element-border:rgba(var(--high-color), 0.4);--element-border-focus:rgb(var(--full-color), 0.75);--element-border-radius:3px;--element-shadow-low:0 1px 3px 0px rgba(0,0,0, 0.25);--element-shadow-mid:0 1px 3px 0px rgba(0,0,0, 0.35);--element-shadow-high:0 1px 5px 0px rgba(0,0,0, 0.45);--code-bk:#1a1e23;--input-bk:rgba(var(--dim-color), 0.6);--input-border:rgba(var(--high-color), 0.4);--header-height:48px;--header-bk:rgba(var(--low-color), 0.985);--header-text:rgb(var(--full-color));--header-border:rgba(var(--full-color), 0.1);--header-border-inverse:rgba(var(--no-color), 0.3);--text-shadow:0 1px 2px rgba(0,0,0,0.8);--svg-size:2vw;--font-size:14px}:target{scroll-margin:calc(var(--header-height)/ .75) 0 0}body:not([hashscroll]) :target{animation:highlight 1.5s .25s ease}body{margin:0;padding:0;font-family:Heebo,san-serif;line-height:1.5em;widows:2;orphans:2;word-wrap:break-word;overflow-wrap:break-word;color:#000;word-spacing:1px;counter-reset:h2 toc1}h1{font-size:2em;font-weight:700;line-height:1.2em}h2{margin:1.5em 0 1em}blockquote{position:relative;padding:0;margin:1.75em .75em;color:rgb(var(--mid-color));background:rgb(var(--faint-color))}blockquote:after,blockquote:before{content:"“";position:absolute;top:.065em;left:.065em;font-size:3em;height:.34em;line-height:100%;color:rgb(var(--low-color))}blockquote:after{content:"”";top:auto;left:auto;bottom:.065em;right:.065em;text-align:center}blockquote>p{padding:.6em 1.8em .5em 1.8em}strong strong{font-size:.9em;color:#b30032;font-weight:400;text-transform:uppercase}main article>ol,main article>ul{padding:0 0 0 2em}main article h1,main article h2,main article h3,main article h4,main article h5,main article h6{color:var(--themed-heading-text)}main article h2,main article h3,main article h4{display:flex;font-weight:500}main article h2{counter-reset:h3 h4}main article h3{counter-reset:h4}main article h2:after{counter-increment:h2;content:counter(h2) ".";padding:0 .4em 0 .2em;order:-1}main article h3:after{counter-increment:h3;content:counter(h2) "." counter(h3);padding:0 .45em 0 .2em;order:-1}main article h4:after{counter-increment:h4;content:counter(h2) "." counter(h3) "." counter(h4);padding:0 .5em 0 .2em;order:-1}h1 .toc-anchor{display:none}.toc-anchor{margin:-.1em 0 0;font-size:.875em;color:inherit;text-decoration:none;opacity:.35;order:-1;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}pre{overflow:auto}code{padding:.085em .3em .1em;font-size:1.075em;color:#c7001c;vertical-align:middle;background:#f0f0f0;border-radius:4px}pre code{background:unset;padding:unset;border-radius:unset}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:1.25em;margin:-.11em .3em 0 0;border-radius:3px}ol,ul{margin:0;padding:0 0 0 1.2em}dl.terms-and-definitions-list{margin:0;padding:0}dl.terms-and-definitions-list dt{font-weight:700;margin:0;background-color:#f0f0f0;border:1px solid #ccc;padding:10px;border-radius:5px 5px 0 0}dl.terms-and-definitions-list dd{margin:0;background-color:#f9f9f9;border:1px solid #ccc;border-top:none;padding:.5em 2em;border-bottom:none}dl.terms-and-definitions-list dd p{margin:0}dl.terms-and-definitions-list dd+dd{border-bottom:none}dl.terms-and-definitions-list dd+dt{margin-top:2em}dl.terms-and-definitions-list dd.last-dd{border-radius:0 0 5px 5px;border-bottom:1px solid #ccc}main{box-sizing:border-box;float:right;width:75%;min-width:calc(100% - 325px);max-width:calc(100% - 275px);padding:.5em 2em 1.5em 2em;background:#fff;box-shadow:0 0 5px -1px rgba(0,0,0,.3)}table{display:block;width:-webkit-fill-available;width:fit-content;max-width:100%;margin:1.5em 0 1.75em;border-spacing:0;border-collapse:collapse;overflow-x:auto;word-wrap:normal;overflow-wrap:normal;hyphens:manual}thead tr th{color:var(--themed-element-text);background:var(--themed-element-bk);border:var(--themed-element-border);text-shadow:0 1px 1px rgba(0,0,0,.5)}tr{border-top:1px solid #ccc;background-color:#fff;margin:0;padding:0}tr:nth-child(2n){background-color:#f0f0f0}tr th{font-weight:400;border:1px solid #ccc;text-align:left;margin:0;padding:6px 13px}td,th{padding:9px 13px;border:1px solid #d8d8d8}tr td{border:1px solid #ccc;text-align:left;margin:0;padding:.55em .75em .55em}tr td :first-child,tr th :first-child{margin-top:0}tr td :last-child,tr th :last-child{margin-bottom:0}table pre[class*=language-]{border:none;border-radius:0}table pre[class*=language-]:before{display:none}svg[icon]{width:1.25em;height:1.25em;vertical-align:text-top;pointer-events:none}article p>img{max-width:100%;margin:0 auto}article li{margin-top:.4em}slide-panel>:not(header):not(footer){flex:1}:not(pre)>code[class*=language-],pre[class*=language-]{padding:.65em .8em .8em;background:var(--code-bk)}.tippy-box{box-shadow:var(--element-shadow-mid)}.tippy-box a{color:var(--active-color)}.tippy-box a:visited{color:var(--visited-color)}.tippy-content{padding:.55em .55em .5em}.tippy-content header{margin:0 0 .4em;padding:.15em .3em .1em;border-radius:2px;background:rgba(255,255,255,.1);text-shadow:0 1px rgba(0,0,0,.9)}.tippy-content table,.tippy-content tbody,.tippy-content td,.tippy-content tr{margin:0;padding:0;border:none;border-spacing:0;border-collapse:collapse;background:0 0!important;background-color:transparent!important}.tippy-content table{margin:0 .3em}.tippy-content td{font-size:.9em;padding:.2em 0 0}.tippy-content td:first-child{padding-right:.5em}a[path-0$="github.com"]:before{content:"\f09b";color:var(--page-text);margin:0 .25em 0 0;font-family:FontAwesome;text-decoration:none;display:inline-block;vertical-align:bottom}a[path-0$="github.com"][path-3=issues][path-4],a[path-0$="github.com"][path-3=projects],a[path-0$="github.com"][path-3=pull],a[path-0$="github.com"][path-3=releases]{text-decoration:none}a[path-0$="github.com"][path-3=issues][path-4] span,a[path-0$="github.com"][path-3=projects] span,a[path-0$="github.com"][path-3=pull] span,a[path-0$="github.com"][path-3=releases] span{display:none}a[path-0$="github.com"][path-3=issues][path-4]:after{content:"Issue #" attr(path-4)}a[path-0$="github.com"][path-3=pull]:after{content:"Pull Request #" attr(path-4)}a[path-0$="github.com"][path-3=releases][path-5]:after{content:"Release " attr(path-5)}a[path-0$="github.com"][path-3=projects]:after{content:"Project #" attr(path-4)}[issue-count]:after{content:"Issues (" attr(issue-count) ")";margin:0 0 0 .3em;padding:.1em 0 0}[issue-count=""][animate]{display:none;opacity:0}[issue-count][animate]:not([issue-count=""]){animation:display-show 1s}[panel-toggle]{cursor:pointer}.panel-header{display:flex;align-items:center;height:var(--header-height)}.panel-header>*{display:flex;height:100%;padding:.1em .8em 0;align-items:center}.slide-panel{width:calc(100% - 1em);max-width:475px;transition:transform .35s ease}.slide-panel[panel-open]{transform:translateX(0)}.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,san-serif}.example pre[class*=language-]{padding:0;border-radius:0}.todo{background:#fbe4ff;border-color:#9700e2}.todo .notice-link{display:block;color:#6d00a2}.mermaid{display:flex;align-items:center;justify-content:center;margin:1.5em 0 1.75em}.reference-list{margin:0;padding:0;list-style:none}.reference-list dd a,.reference-status{font-style:italic}.reference-status{color:var(--green-status)}.tippy-box .reference-status{color:var(--light-green-status)}code[class*=language-],pre,pre[class*=language-]{font-size:.9em;margin:1em 0 1.5em;border-radius:3px}.example code[class*=language-],.example pre,.example pre[class*=language-]{margin:0}#svg{display:none}#header{position:sticky;position:-webkit-sticky;padding:0;top:0;margin:-.5em -2em 0 -2em;background:rgba(255,255,255,.9);border-bottom:1px solid rgba(0,0,0,.175);box-shadow:0 1px 3px 1px rgba(0,0,0,.1);z-index:2}#logo{box-sizing:border-box;display:flex;align-items:center;height:100%;padding:.5em}#logo img{height:100%}#logo+span{margin-left:auto}#header #toc_toggle{display:none;padding:0 1em;border-right:1px solid rgba(0,0,0,.15)}#content{max-width:800px}#content h1:first-of-type{margin:1em 0 .5em}#content h1:first-of-type .markdownIt-Anchor{display:none}#repo_issues{width:calc(100% - 1.5em);max-width:450px;border-left:1px solid rgba(0,0,0,.15)}#repo_issues>header{background:#eee;border-bottom:1px solid #ddd}#repo_issues>header span:first-of-type{font-weight:700;padding-top:.1em}#repo_issues>header .repo-issue-toggle{margin-left:auto;color:inherit;font-weight:700;text-decoration:none}#repo_issue_list{list-style:none;margin:0;padding:0 1.25em 1.25em;font-size:.85em;overflow:auto;-ms-overflow-style:none;scrollbar-width:none}#repo_issue_list::-webkit-scrollbar{display:none}#repo_issue_list:empty:before{content:"No issues found";display:block;text-align:center;font-size:1.1em;color:#aaa;margin:1em 0 0}.repo-issue detail-box{display:flex;flex-direction:column;padding:1em 0;border-bottom:1px solid #ddd}.repo-issue detail-box>section{order:1}.repo-issue detail-box>section:empty+.repo-issue-title [detail-box-toggle]{display:none}.repo-issue-title{display:flex;align-items:center}.repo-issue-link{flex:1;margin:0 0 0 .5em}.repo-issue-number{height:1em;margin:0 .4em 0 0;padding:.3em .25em 0;border-radius:3px;font-weight:700;background:#eee;border:1px solid #ddd;text-align:center;line-height:1em}.repo-issue-number:before{content:"#";font-weight:400;margin:0 .1em 0 0}.repo-issue [detail-box-toggle]{margin:0 0 0 1em;opacity:.35;transition:opacity .4s}.repo-issue [detail-box-toggle]:hover,.repo-issue detail-box[open] [detail-box-toggle]{opacity:1}#toc{display:flex;flex-direction:column;width:25%;max-width:325px;min-width:275px;background:#eceff1}#toc header{color:var(--themed-element-text);background:var(--themed-element-bk);box-shadow:0 1px 3px 0 rgba(0,0,0,.3);border:var(--themed-element-border);border-top:none;border-left:none}#toc header [panel-toggle]{display:none;height:var(--header-height);line-height:var(--header-height);margin-left:auto;padding:0 1em;color:inherit;font-weight:700;text-decoration:none}#toc_list{flex:1;padding:1em .8em;overflow:auto}.toc{padding:0 0 1.75em;font-size:.85em}.toc,.toc ul{margin:0;list-style:none}.toc ul{padding:0 0 0 1em}.toc a{display:block;padding:.4em .3em .225em;text-decoration:none;border-radius:3px;color:#333}.toc a:before{color:#000;font-weight:700}.toc a:hover{text-shadow:0 1px 1px #fff;background:rgba(0,0,0,.1)}.toc>li a:before{counter-increment:toc1;content:counter(toc1) ".";padding:0 .4em 0 .2em}.toc>li>ul{counter-reset:toc2}.toc>li>ul>li a:before{counter-increment:toc2;content:counter(toc1) "." counter(toc2);padding:0 .45em 0 .2em}.toc>li>ul ul{counter-reset:toc3}.toc>li>ul ul li a:before{counter-increment:toc3;content:counter(toc1) "." counter(toc2) "." counter(toc3);padding:0 .5em 0 .2em}@media (min-width:900px){slide-panel{z-index:2}#slidepanels[open=sidebar]:before{opacity:0;transition:none;pointer-events:none}#slidepanels:before{z-index:1}#toc{transition:none;transform:translate3d(0,0,0);box-shadow:0 0 5px 1px rgba(0,0,0,.15) inset;z-index:0}}@media (max-width:900px){main{width:100%;min-width:auto;max-width:none;padding:.5em 1.25em 1.5em 1.25em}#header{margin:-.5em -1.25em 0 -1.25em}#toc header [panel-toggle]{display:block}#header #toc_toggle{display:flex}}@media (max-width:550px){td{font-size:.8em}}@keyframes display-show{0%{display:none;opacity:0}1%{display:block}100%{opacity:1}}@keyframes highlight{50%{background-color:#ff0}}article a[href^="https://"]:not(.btn)::after,article a[href^=http]:not(.btn)::after{content:'';width:12px;height:12px;margin-left:4px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;background-size:contain;display:inline-block}.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}.powered-by,.snapshots{margin:0;padding:0;flex:none}.powered-by{text-align:center;font-size:.7em}.snapshots a{display:block;margin:.5em;padding:.5em .8em;border-radius:.25rem;background:#a9dde0;color:#03365f;text-decoration:none;font-size:1rem}
|
|
14
|
+
:root{--base-theme-color:207,71%;--themed-element-bk:hsl(var(--base-theme-color), 40%);--themed-element-text:#fff;--themed-element-border:1px solid hsl(var(--base-theme-color), 26%);--themed-heading-text:hsl(var(--base-theme-color), 30%);--no-color:255,255,255;--faint-color:245,245,245;--dim-color:225,225,225;--low-color:200,200,200;--mid-color:100,100,100;--high-color:50,50,50;--full-color:0,0,0;--active-color:#3aaaff;--visited-color:rgb(188, 129, 255);--green-status:rgb(0, 123, 9);--light-green-status:rgb(0, 194, 13);--page-bk:rgb(var(--no-color));--page-text:rgb(var(--full-color));--page-text-hover:rgb(var(--full-color));--element-bk:rgb(var(--no-color));--element-bk-hover:rgba(var(--low-color), 0.5);--element-bk-transparent:rgba(var(--dim-color), 0.92);--element-border:rgba(var(--high-color), 0.4);--element-border-focus:rgb(var(--full-color), 0.75);--element-border-radius:3px;--element-shadow-low:0 1px 3px 0px rgba(0,0,0, 0.25);--element-shadow-mid:0 1px 3px 0px rgba(0,0,0, 0.35);--element-shadow-high:0 1px 5px 0px rgba(0,0,0, 0.45);--code-bk:#1a1e23;--input-bk:rgba(var(--dim-color), 0.6);--input-border:rgba(var(--high-color), 0.4);--header-height:48px;--header-bk:rgba(var(--low-color), 0.985);--header-text:rgb(var(--full-color));--header-border:rgba(var(--full-color), 0.1);--header-border-inverse:rgba(var(--no-color), 0.3);--text-shadow:0 1px 2px rgba(0,0,0,0.8);--svg-size:2vw;--font-size:14px}:target{scroll-margin:calc(var(--header-height)/ .75) 0 0}body:not([hashscroll]) :target{animation:highlight 1.5s .25s ease}body{margin:0;padding:0;font-family:Heebo,san-serif;line-height:1.5em;widows:2;orphans:2;word-wrap:break-word;overflow-wrap:break-word;color:#000;word-spacing:1px;counter-reset:h2 toc1}h1{font-size:2em;font-weight:700;line-height:1.2em}h2{margin:1.5em 0 1em}blockquote{position:relative;padding:0;margin:1.75em .75em;color:rgb(var(--mid-color));background:rgb(var(--faint-color))}blockquote:after,blockquote:before{content:"“";position:absolute;top:.065em;left:.065em;font-size:3em;height:.34em;line-height:100%;color:rgb(var(--low-color))}blockquote:after{content:"”";top:auto;left:auto;bottom:.065em;right:.065em;text-align:center}blockquote>p{padding:.6em 1.8em .5em 1.8em}strong strong{font-size:.9em;color:#b30032;font-weight:400;text-transform:uppercase}main article>ol,main article>ul{padding:0 0 0 2em}main article h1,main article h2,main article h3,main article h4,main article h5,main article h6{color:var(--themed-heading-text)}main article h2,main article h3,main article h4{display:flex;font-weight:500}main article h2{counter-reset:h3 h4}main article h3{counter-reset:h4}main article h2:after{counter-increment:h2;content:counter(h2) ".";padding:0 .4em 0 .2em;order:-1}main article h3:after{counter-increment:h3;content:counter(h2) "." counter(h3);padding:0 .45em 0 .2em;order:-1}main article h4:after{counter-increment:h4;content:counter(h2) "." counter(h3) "." counter(h4);padding:0 .5em 0 .2em;order:-1}h1 .toc-anchor{display:none}.toc-anchor{margin:-.1em 0 0;font-size:.875em;color:inherit;text-decoration:none;opacity:.35;order:-1;transition:opacity .3s ease}.toc-anchor:hover{opacity:1}pre{overflow:auto}code{padding:.085em .3em .1em;font-size:1.075em;color:#c7001c;vertical-align:middle;background:#f0f0f0;border-radius:4px}pre code{background:unset;padding:unset;border-radius:unset}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:1.25em;margin:-.11em .3em 0 0;border-radius:3px}ol,ul{margin:0;padding:0 0 0 1.2em}dl.terms-and-definitions-list{margin:0;padding:0}dl.terms-and-definitions-list>dt{font-weight:700;margin:0;background-color:#f0f0f0;border:1px solid #ccc;padding:10px;border-radius:5px 5px 0 0}dl.terms-and-definitions-list>dd{margin:0;background-color:#f9f9f9;border:1px solid #ccc;border-top:none;padding:.5em 2em;border-bottom:none}dl.terms-and-definitions-list dd p{margin:0}dl.terms-and-definitions-list dd+dd{border-bottom:none}dl.terms-and-definitions-list dd+dt{margin-top:2em}dl.terms-and-definitions-list dd.last-dd{border-radius:0 0 5px 5px;border-bottom:1px solid #ccc}main{box-sizing:border-box;float:right;width:75%;min-width:calc(100% - 325px);max-width:calc(100% - 275px);padding:.5em 2em 1.5em 2em;background:#fff;box-shadow:0 0 5px -1px rgba(0,0,0,.3)}table{display:block;width:-webkit-fill-available;width:fit-content;max-width:100%;margin:1.5em 0 1.75em;border-spacing:0;border-collapse:collapse;overflow-x:auto;word-wrap:normal;overflow-wrap:normal;hyphens:manual}thead tr th{color:var(--themed-element-text);background:var(--themed-element-bk);border:var(--themed-element-border);text-shadow:0 1px 1px rgba(0,0,0,.5)}tr{border-top:1px solid #ccc;background-color:#fff;margin:0;padding:0}tr:nth-child(2n){background-color:#f0f0f0}tr th{font-weight:400;border:1px solid #ccc;text-align:left;margin:0;padding:6px 13px}td,th{padding:9px 13px;border:1px solid #d8d8d8}tr td{border:1px solid #ccc;text-align:left;margin:0;padding:.55em .75em .55em}tr td :first-child,tr th :first-child{margin-top:0}tr td :last-child,tr th :last-child{margin-bottom:0}table pre[class*=language-]{border:none;border-radius:0}table pre[class*=language-]:before{display:none}svg[icon]{width:1.25em;height:1.25em;vertical-align:text-top;pointer-events:none}article p>img{max-width:100%;margin:0 auto}article li{margin-top:.4em}slide-panel>:not(header):not(footer){flex:1}:not(pre)>code[class*=language-],pre[class*=language-]{padding:.65em .8em .8em;background:var(--code-bk)}.tippy-box{box-shadow:var(--element-shadow-mid)}.tippy-box a{color:var(--active-color)}.tippy-box a:visited{color:var(--visited-color)}.tippy-content{padding:.55em .55em .5em}.tippy-content header{margin:0 0 .4em;padding:.15em .3em .1em;border-radius:2px;background:rgba(255,255,255,.1);text-shadow:0 1px rgba(0,0,0,.9)}.tippy-content table,.tippy-content tbody,.tippy-content td,.tippy-content tr{margin:0;padding:0;border:none;border-spacing:0;border-collapse:collapse;background:0 0!important;background-color:transparent!important}.tippy-content table{margin:0 .3em}.tippy-content td{font-size:.9em;padding:.2em 0 0}.tippy-content td:first-child{padding-right:.5em}a[path-0$="github.com"]:before{content:"\f09b";color:var(--page-text);margin:0 .25em 0 0;font-family:FontAwesome;text-decoration:none;display:inline-block;vertical-align:bottom}a[path-0$="github.com"][path-3=issues][path-4],a[path-0$="github.com"][path-3=projects],a[path-0$="github.com"][path-3=pull],a[path-0$="github.com"][path-3=releases]{text-decoration:none}a[path-0$="github.com"][path-3=issues][path-4] span,a[path-0$="github.com"][path-3=projects] span,a[path-0$="github.com"][path-3=pull] span,a[path-0$="github.com"][path-3=releases] span{display:none}a[path-0$="github.com"][path-3=issues][path-4]:after{content:"Issue #" attr(path-4)}a[path-0$="github.com"][path-3=pull]:after{content:"Pull Request #" attr(path-4)}a[path-0$="github.com"][path-3=releases][path-5]:after{content:"Release " attr(path-5)}a[path-0$="github.com"][path-3=projects]:after{content:"Project #" attr(path-4)}[issue-count]:after{content:"Issues (" attr(issue-count) ")";margin:0 0 0 .3em;padding:.1em 0 0}[issue-count=""][animate]{display:none;opacity:0}[issue-count][animate]:not([issue-count=""]){animation:display-show 1s}[panel-toggle]{cursor:pointer}.panel-header{display:flex;align-items:center;height:var(--header-height)}.panel-header>*{display:flex;height:100%;padding:.1em .8em 0;align-items:center}.slide-panel{width:calc(100% - 1em);max-width:475px;transition:transform .35s ease}.slide-panel[panel-open]{transform:translateX(0)}.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,san-serif}.example pre[class*=language-]{padding:0;border-radius:0}.todo{background:#fbe4ff;border-color:#9700e2}.todo .notice-link{display:block;color:#6d00a2}.mermaid{display:flex;align-items:center;justify-content:center;margin:1.5em 0 1.75em}.reference-list{margin:0;padding:0;list-style:none}.reference-list dd a,.reference-status{font-style:italic}.reference-status{color:var(--green-status)}.tippy-box .reference-status{color:var(--light-green-status)}code[class*=language-],pre,pre[class*=language-]{font-size:.9em;margin:1em 0 1.5em;border-radius:3px}.example code[class*=language-],.example pre,.example pre[class*=language-]{margin:0}#svg{display:none}#header{position:sticky;position:-webkit-sticky;padding:0;top:0;margin:-.5em -2em 0 -2em;background:rgba(255,255,255,.9);border-bottom:1px solid rgba(0,0,0,.175);box-shadow:0 1px 3px 1px rgba(0,0,0,.1);z-index:2}#logo{box-sizing:border-box;display:flex;align-items:center;height:100%;padding:.5em}#logo img{height:100%}#logo+span{margin-left:auto}#header #toc_toggle{display:none;padding:0 1em;border-right:1px solid rgba(0,0,0,.15)}#content{max-width:800px}#content h1:first-of-type{margin:1em 0 .5em}#content h1:first-of-type .markdownIt-Anchor{display:none}#repo_issues{width:calc(100% - 1.5em);max-width:450px;border-left:1px solid rgba(0,0,0,.15)}#repo_issues>header{background:#eee;border-bottom:1px solid #ddd}#repo_issues>header span:first-of-type{font-weight:700;padding-top:.1em}#repo_issues>header .repo-issue-toggle{margin-left:auto;color:inherit;font-weight:700;text-decoration:none}#repo_issue_list{list-style:none;margin:0;padding:0 1.25em 1.25em;font-size:.85em;overflow:auto;-ms-overflow-style:none;scrollbar-width:none}#repo_issue_list::-webkit-scrollbar{display:none}#repo_issue_list:empty:before{content:"No issues found";display:block;text-align:center;font-size:1.1em;color:#aaa;margin:1em 0 0}.repo-issue detail-box{display:flex;flex-direction:column;padding:1em 0;border-bottom:1px solid #ddd}.repo-issue detail-box>section{order:1}.repo-issue detail-box>section:empty+.repo-issue-title [detail-box-toggle]{display:none}.repo-issue-title{display:flex;align-items:center}.repo-issue-link{flex:1;margin:0 0 0 .5em}.repo-issue-number{height:1em;margin:0 .4em 0 0;padding:.3em .25em 0;border-radius:3px;font-weight:700;background:#eee;border:1px solid #ddd;text-align:center;line-height:1em}.repo-issue-number:before{content:"#";font-weight:400;margin:0 .1em 0 0}.repo-issue [detail-box-toggle]{margin:0 0 0 1em;opacity:.35;transition:opacity .4s}.repo-issue [detail-box-toggle]:hover,.repo-issue detail-box[open] [detail-box-toggle]{opacity:1}#toc{display:flex;flex-direction:column;width:25%;max-width:325px;min-width:275px;background:#eceff1}#toc header{color:var(--themed-element-text);background:var(--themed-element-bk);box-shadow:0 1px 3px 0 rgba(0,0,0,.3);border:var(--themed-element-border);border-top:none;border-left:none}#toc header [panel-toggle]{display:none;height:var(--header-height);line-height:var(--header-height);margin-left:auto;padding:0 1em;color:inherit;font-weight:700;text-decoration:none}#toc_list{flex:1;padding:1em .8em;overflow:auto}.toc{padding:0 0 1.75em;font-size:.85em}.toc,.toc ul{margin:0;list-style:none}.toc ul{padding:0 0 0 1em}.toc a{display:block;padding:.4em .3em .225em;text-decoration:none;border-radius:3px;color:#333}.toc a:before{color:#000;font-weight:700}.toc a:hover{text-shadow:0 1px 1px #fff;background:rgba(0,0,0,.1)}.toc>li a:before{counter-increment:toc1;content:counter(toc1) ".";padding:0 .4em 0 .2em}.toc>li>ul{counter-reset:toc2}.toc>li>ul>li a:before{counter-increment:toc2;content:counter(toc1) "." counter(toc2);padding:0 .45em 0 .2em}.toc>li>ul ul{counter-reset:toc3}.toc>li>ul ul li a:before{counter-increment:toc3;content:counter(toc1) "." counter(toc2) "." counter(toc3);padding:0 .5em 0 .2em}@media (min-width:900px){slide-panel{z-index:2}#slidepanels[open=sidebar]:before{opacity:0;transition:none;pointer-events:none}#slidepanels:before{z-index:1}#toc{transition:none;transform:translate3d(0,0,0);box-shadow:0 0 5px 1px rgba(0,0,0,.15) inset;z-index:0}}@media (max-width:900px){main{width:100%;min-width:auto;max-width:none;padding:.5em 1.25em 1.5em 1.25em}#header{margin:-.5em -1.25em 0 -1.25em}#toc header [panel-toggle]{display:block}#header #toc_toggle{display:flex}}@media (max-width:550px){td{font-size:.8em}}@keyframes display-show{0%{display:none;opacity:0}1%{display:block}100%{opacity:1}}@keyframes highlight{50%{background-color:#ff0}}article a[href^="https://"]:not(.btn)::after,article a[href^=http]:not(.btn)::after{content:'';width:12px;height:12px;margin-left:4px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;background-size:contain;display:inline-block}.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}.powered-by,.snapshots{margin:0;padding:0;flex:none}.powered-by{text-align:center;font-size:.7em}.snapshots a{display:block;margin:.5em;padding:.5em .8em;border-radius:.25rem;background:#a9dde0;color:#03365f;text-decoration:none;font-size:1rem}.transcluded-xref-term{background:#a9dde03b!important;padding:.5em;margin:1em 0}.transclusion-heading{font-size:1.3em;font-weight:700;margin:1em 0 .5em}.loader{width:20px;height:20px;margin:auto;display:block;text-align:center;border:8px solid #ccc;border-top-color:#3498db;border-radius:50%;animation:spin 1s linear infinite}.loadertext{text-align:center;margin:.5em 0}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
|
package/assets/css/index.css
CHANGED
|
@@ -233,7 +233,7 @@ dl.terms-and-definitions-list {
|
|
|
233
233
|
padding: 0;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
dl.terms-and-definitions-list dt {
|
|
236
|
+
dl.terms-and-definitions-list > dt {
|
|
237
237
|
font-weight: bold;
|
|
238
238
|
margin: 0;
|
|
239
239
|
background-color: #f0f0f0;
|
|
@@ -242,7 +242,7 @@ dl.terms-and-definitions-list dt {
|
|
|
242
242
|
border-radius: 5px 5px 0 0;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
dl.terms-and-definitions-list dd {
|
|
245
|
+
dl.terms-and-definitions-list > dd {
|
|
246
246
|
margin: 0;
|
|
247
247
|
background-color: #f9f9f9;
|
|
248
248
|
border: 1px solid #ccc;
|
|
@@ -1007,4 +1007,46 @@ article a[href^="https://"]:not(.btn)::after {
|
|
|
1007
1007
|
color: #03365f;
|
|
1008
1008
|
text-decoration: none;
|
|
1009
1009
|
font-size: 1rem;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.transcluded-xref-term {
|
|
1013
|
+
background: #a9dde03b !important;
|
|
1014
|
+
padding: 0.5em;
|
|
1015
|
+
margin: 1em 0;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.transclusion-heading {
|
|
1019
|
+
font-size: 1.3em;
|
|
1020
|
+
font-weight: bold;
|
|
1021
|
+
margin: 1em 0 0.5em;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
/* Loader styling */
|
|
1026
|
+
.loader {
|
|
1027
|
+
width: 20px;
|
|
1028
|
+
height: 20px;
|
|
1029
|
+
margin: auto;
|
|
1030
|
+
display: block;
|
|
1031
|
+
text-align: center;
|
|
1032
|
+
border: 8px solid #ccc;
|
|
1033
|
+
border-top-color: #3498db;
|
|
1034
|
+
border-radius: 50%;
|
|
1035
|
+
animation: spin 1s linear infinite;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
.loadertext {
|
|
1039
|
+
text-align: center;
|
|
1040
|
+
margin: 0.5em 0;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/* Animation keyframes */
|
|
1044
|
+
@keyframes spin {
|
|
1045
|
+
0% {
|
|
1046
|
+
transform: rotate(0deg);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
100% {
|
|
1050
|
+
transform: rotate(360deg);
|
|
1051
|
+
}
|
|
1010
1052
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
JS to help with CSS.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function addClassToTranscludedTerms() {
|
|
6
|
+
// Find all spans with class 'transcluded-xref-term'
|
|
7
|
+
const spans = document.querySelectorAll('span.transcluded-xref-term');
|
|
8
|
+
|
|
9
|
+
spans.forEach(span => {
|
|
10
|
+
// Find the closest <dt> ancestor
|
|
11
|
+
const dt = span.closest('dt');
|
|
12
|
+
if (dt) {
|
|
13
|
+
// Add class 'transcluded-xref-term' to the <dt>
|
|
14
|
+
dt.classList.add('transcluded-xref-term');
|
|
15
|
+
|
|
16
|
+
// Get the next sibling elements until the next <dt> or </dl>
|
|
17
|
+
let sibling = dt.nextElementSibling;
|
|
18
|
+
while (sibling && sibling.tagName !== 'DT' && sibling.tagName !== 'DL') {
|
|
19
|
+
if (sibling.tagName === 'DD') {
|
|
20
|
+
sibling.classList.add('transcluded-xref-term');
|
|
21
|
+
}
|
|
22
|
+
sibling = sibling.nextElementSibling;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
29
|
+
addClassToTranscludedTerms();
|
|
30
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file This file fetches and displays commit hashes by matching elements with `x-term-reference` class against the `
|
|
2
|
+
* @file This file fetches and displays commit hashes by matching elements with `x-term-reference` class against the `allXTrefs` global object.
|
|
3
3
|
* Example:
|
|
4
|
-
* const
|
|
5
|
-
"
|
|
4
|
+
* const allXTrefs = {
|
|
5
|
+
"xtrefs": [
|
|
6
6
|
{
|
|
7
7
|
"externalSpec": "test-1",
|
|
8
8
|
"term": "Aal",
|
|
@@ -25,19 +25,54 @@
|
|
|
25
25
|
* @since 2024-06-09
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
var md = window.markdownit();
|
|
29
|
+
|
|
28
30
|
function fetchCommitHashes() {
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
async function insertGitHubTermRealTime(match, element) {
|
|
33
|
+
const div = document.createElement('div');
|
|
34
|
+
div.classList.add('fetched-xref-term');
|
|
35
|
+
div.classList.add('transcluded-xref-term');
|
|
36
|
+
div.innerHTML = "<p class='loadertext'>Loading external reference</p><div class='loader'></div>";
|
|
37
|
+
element.parentNode.insertBefore(div, element.nextSibling);
|
|
38
|
+
|
|
39
|
+
// Promise.all waits for both termPromise and delayPromise to complete if termPromise finishes within 2000 ms.If termPromise takes longer than 2000 ms, the delay is effectively bypassed because Promise.all only cares about both promises finishing, regardless of the time taken by each.
|
|
40
|
+
|
|
41
|
+
// Start fetching the GitHub term asynchronously
|
|
42
|
+
const termPromise = fetchGitHubTerm(savedToken, match);
|
|
43
|
+
|
|
44
|
+
// Create a delay of 2000 ms
|
|
45
|
+
const delayPromise = new Promise(resolve => setTimeout(resolve, 2000));
|
|
46
|
+
|
|
47
|
+
// Wait for whichever completes last between termPromise and delayPromise. The square brackets are used for array destructuring. In this context, the code is awaiting the resolution of multiple promises (termPromise and delayPromise) using Promise.all. The result of Promise.all is an array, and the square brackets are used to extract the first element of that array into the variable term.
|
|
48
|
+
const [term] = await Promise.all([termPromise, delayPromise]);
|
|
49
|
+
|
|
50
|
+
const timestamp = Date.now();
|
|
51
|
+
const date = new Date(timestamp);
|
|
52
|
+
const options = {
|
|
53
|
+
year: 'numeric',
|
|
54
|
+
month: 'long',
|
|
55
|
+
day: 'numeric',
|
|
56
|
+
hour: '2-digit',
|
|
57
|
+
minute: '2-digit',
|
|
58
|
+
second: '2-digit'
|
|
59
|
+
};
|
|
60
|
+
const humanReadableDate = date.toLocaleDateString('en-US', options);
|
|
61
|
+
|
|
62
|
+
// Now that either both are complete or the term has taken longer than 2000 ms, continue with your code
|
|
63
|
+
div.innerHTML = "<p class='transclusion-heading'>Current definition</p><small>" + humanReadableDate + "</small>" + term;
|
|
64
|
+
}
|
|
65
|
+
// Check if allXTrefs is undefined or does not exist
|
|
66
|
+
if (typeof allXTrefs === 'undefined' || allXTrefs === null) {
|
|
67
|
+
console.log('allXTrefs is not defined or does not exist. We will continue without it.');
|
|
33
68
|
return;
|
|
34
69
|
}
|
|
35
|
-
|
|
70
|
+
|
|
36
71
|
// Load GitHub API token from local storage if it exists
|
|
37
72
|
const savedToken = localStorage.getItem('githubToken');
|
|
38
|
-
|
|
39
|
-
//
|
|
40
|
-
|
|
73
|
+
|
|
74
|
+
// Markdown parser, assuming markdown-it and markdown-it-deflist are globally available
|
|
75
|
+
const md = window.markdownit().use(window.markdownitDeflist);
|
|
41
76
|
|
|
42
77
|
// A: Debounce function to delay execution, so the error message is not displayed too often, since we do not know of often and how many times the error will be triggered.
|
|
43
78
|
function debounce(func, wait) {
|
|
@@ -79,7 +114,7 @@ function fetchCommitHashes() {
|
|
|
79
114
|
.then(data => {
|
|
80
115
|
// Decode base64 encoded content
|
|
81
116
|
const decodedContent = atob(data.content);
|
|
82
|
-
|
|
117
|
+
|
|
83
118
|
// Diff the content of the current term-file with the content of stored version
|
|
84
119
|
// See https://www.npmjs.com/package/diff , examples
|
|
85
120
|
const diff = Diff.diffChars(match.content, decodedContent),
|
|
@@ -93,7 +128,7 @@ function fetchCommitHashes() {
|
|
|
93
128
|
|
|
94
129
|
const backgroundColor = part.added ? '#ddd' :
|
|
95
130
|
part.removed ? '#ddd' : 'white';
|
|
96
|
-
|
|
131
|
+
|
|
97
132
|
span = document.createElement('span');
|
|
98
133
|
span.style.color = color;
|
|
99
134
|
span.style.backgroundColor = backgroundColor;
|
|
@@ -101,7 +136,7 @@ function fetchCommitHashes() {
|
|
|
101
136
|
span.appendChild(document
|
|
102
137
|
.createTextNode(part.value));
|
|
103
138
|
fragment.appendChild(span);
|
|
104
|
-
|
|
139
|
+
});
|
|
105
140
|
// Create a temporary container to hold the fragment
|
|
106
141
|
const tempContainer = document.createElement('div');
|
|
107
142
|
tempContainer.innerHTML = '<h1>Diff xref (local snapshot) and latest version</h1>';
|
|
@@ -115,6 +150,47 @@ function fetchCommitHashes() {
|
|
|
115
150
|
});
|
|
116
151
|
}
|
|
117
152
|
|
|
153
|
+
async function fetchGitHubTerm(savedToken, match) {
|
|
154
|
+
function processSpecUpMarkdown(markdown) {
|
|
155
|
+
|
|
156
|
+
// Replace all occurrences of [[def: ]] with ''
|
|
157
|
+
const defRegex = /\[\[def: ([^\]]+)\]\]/g;
|
|
158
|
+
markdown = markdown.replace(defRegex, '');
|
|
159
|
+
|
|
160
|
+
// // Replace all occurrences of [[ref: ]] with <a href="#"></a>
|
|
161
|
+
// const refRegex = /\[\[ref: ([^\]]+)\]\]/g;
|
|
162
|
+
// markdown = markdown.replace(refRegex, '<a class="x-term-reference" data-local-href="ref:$1">$1</a>');
|
|
163
|
+
|
|
164
|
+
return md.render(markdown);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const headers = {};
|
|
168
|
+
if (savedToken && savedToken.length > 0) {
|
|
169
|
+
headers['Authorization'] = `token ${savedToken}`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
const response = await fetch('https://api.github.com/repos/' + match.owner + '/' + match.repo + '/contents/' + match.terms_dir + '/' + match.term.replace(/ /g, '-').toLowerCase() + '.md', { headers: headers });
|
|
174
|
+
|
|
175
|
+
if (response.status === 403 && response.headers.get('X-RateLimit-Remaining') === '0') {
|
|
176
|
+
const resetTime = new Date(response.headers.get('X-RateLimit-Reset') * 1000);
|
|
177
|
+
console.error(`\n SPEC-UP-T: Github API rate limit exceeded. Try again after ${resetTime}. See https://blockchainbird.github.io/spec-up-t-website/docs/github-token/ for more info.` + "\n");
|
|
178
|
+
|
|
179
|
+
debouncedError();
|
|
180
|
+
return true;
|
|
181
|
+
} else {
|
|
182
|
+
console.log(`\n SPEC-UP-T: Github API rate limit: ${response.headers.get('X-RateLimit-Remaining')} requests remaining. See https://blockchainbird.github.io/spec-up-t-website/docs/github-token/ for more info.` + "\n");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const data = await response.json();
|
|
186
|
+
const decodedContent = atob(data.content);
|
|
187
|
+
const processedContent = processSpecUpMarkdown(decodedContent);
|
|
188
|
+
return processedContent;
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error('Error fetching content:', error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
118
194
|
// get all elements with class “x-term-reference”
|
|
119
195
|
const elements = document.querySelectorAll('.x-term-reference');
|
|
120
196
|
|
|
@@ -125,18 +201,18 @@ function fetchCommitHashes() {
|
|
|
125
201
|
// split href on “:” and create array
|
|
126
202
|
const splitHref = href.split(':');
|
|
127
203
|
|
|
128
|
-
//
|
|
129
|
-
|
|
204
|
+
// allXTrefs is an object that is available in the global scope
|
|
205
|
+
allXTrefs.xtrefs.forEach((match) => {
|
|
130
206
|
|
|
131
207
|
//TODO: remove toLowerCase() or not?
|
|
132
208
|
if (match.externalSpec === splitHref[1] && match.term.toLowerCase() === splitHref[2].toLowerCase()) {
|
|
133
|
-
|
|
209
|
+
|
|
134
210
|
// If no commit hash is found, display a message and return
|
|
135
211
|
if (!match.commitHash) {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
element.parentNode.insertBefore(
|
|
212
|
+
const noXTrefFoundMessage = document.createElement('span');
|
|
213
|
+
noXTrefFoundMessage.classList.add('no-xref-found-message');
|
|
214
|
+
noXTrefFoundMessage.innerHTML = 'No xref found.';
|
|
215
|
+
element.parentNode.insertBefore(noXTrefFoundMessage, element.nextSibling);
|
|
140
216
|
|
|
141
217
|
return
|
|
142
218
|
};
|
|
@@ -191,9 +267,16 @@ function fetchCommitHashes() {
|
|
|
191
267
|
localStoredTerm.innerHTML = 'Xref';
|
|
192
268
|
localStoredTerm.title = 'Show the stored version of the term-file';
|
|
193
269
|
showDiffModal.parentNode.insertBefore(localStoredTerm, element.nextSibling);
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
// Replace all occurrences of [[def: ]] with ''
|
|
274
|
+
const defRegex = /\[\[def: ([^\]]+)\]\]/g;
|
|
275
|
+
match.content = match.content.replace(defRegex, '');
|
|
276
|
+
|
|
277
|
+
const content = md.render(match.content);
|
|
194
278
|
localStoredTerm.addEventListener('click', function (event) {
|
|
195
279
|
event.preventDefault();
|
|
196
|
-
const content = match.content.replace(/\n/g, '<br>');
|
|
197
280
|
showModal(`
|
|
198
281
|
<h1>Term definition (local snapshot)</h1>
|
|
199
282
|
<table>
|
|
@@ -208,6 +291,15 @@ function fetchCommitHashes() {
|
|
|
208
291
|
</table>
|
|
209
292
|
`);
|
|
210
293
|
});
|
|
294
|
+
|
|
295
|
+
const div = document.createElement('div');
|
|
296
|
+
div.classList.add('local-snapshot-xref-term');
|
|
297
|
+
div.classList.add('transcluded-xref-term');
|
|
298
|
+
div.innerHTML = `<p class='transclusion-heading'>Snapshot</p><p>Commit Hash: ${match.commitHash}</p> ${content}`;
|
|
299
|
+
element.parentNode.insertBefore(div, element.nextSibling);
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
insertGitHubTermRealTime(match, element);
|
|
211
303
|
}
|
|
212
304
|
});
|
|
213
305
|
});
|
package/index.js
CHANGED
|
@@ -13,12 +13,12 @@ module.exports = function (options = {}) {
|
|
|
13
13
|
const { runJsonKeyValidatorSync } = require('./src/json-key-validator.js');
|
|
14
14
|
runJsonKeyValidatorSync();
|
|
15
15
|
|
|
16
|
-
const { createTermRelations } = require('./src/create-term-relations.js');
|
|
17
|
-
createTermRelations();
|
|
16
|
+
// const { createTermRelations } = require('./src/create-term-relations.js');
|
|
17
|
+
// createTermRelations();
|
|
18
18
|
|
|
19
19
|
const { createTermIndex } = require('./src/create-term-index.js');
|
|
20
20
|
createTermIndex();
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const { insertTermIndex } = require('./src/insert-term-index.js');
|
|
23
23
|
insertTermIndex();
|
|
24
24
|
|
|
@@ -31,6 +31,8 @@ module.exports = function (options = {}) {
|
|
|
31
31
|
|
|
32
32
|
const { fixMarkdownFiles } = require('./src/fix-markdown-files.js');
|
|
33
33
|
|
|
34
|
+
const { prepareTref } = require('./src/prepare-tref.js');
|
|
35
|
+
|
|
34
36
|
let template = fs.readFileSync(path.join(modulePath, 'templates/template.html'), 'utf8');
|
|
35
37
|
let assets = fs.readJsonSync(modulePath + '/src/asset-map.json');
|
|
36
38
|
let externalReferences;
|
|
@@ -48,24 +50,26 @@ module.exports = function (options = {}) {
|
|
|
48
50
|
return fs.readFileSync(path, 'utf8');
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
|
-
];
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
prepareTref(path.join(config.specs[0].spec_directory, config.specs[0].spec_terms_directory));
|
|
52
56
|
|
|
53
57
|
// Synchronously process markdown files
|
|
54
58
|
fixMarkdownFiles(path.join(config.specs[0].spec_directory, config.specs[0].spec_terms_directory));
|
|
55
|
-
|
|
56
|
-
function createScriptElementWithXrefDataForEmbeddingInHtml() {
|
|
57
|
-
// Test if xrefs-data.js exists, else make it an empty string
|
|
58
|
-
const inputPath = path.join('output', 'xrefs-data.js');
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
function createScriptElementWithXTrefDataForEmbeddingInHtml() {
|
|
61
|
+
// Test if xtrefs-data.js exists, else make it an empty string
|
|
62
|
+
const inputPath = path.join('output', 'xtrefs-data.js');
|
|
63
|
+
|
|
64
|
+
let xtrefsData = "";
|
|
61
65
|
if (fs.existsSync(inputPath)) {
|
|
62
|
-
|
|
66
|
+
xtrefsData = '<script>' + fs.readFileSync(inputPath, 'utf8') + '</script>';
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
return
|
|
69
|
+
return xtrefsData;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
const
|
|
72
|
+
const xtrefsData = createScriptElementWithXTrefDataForEmbeddingInHtml();
|
|
69
73
|
|
|
70
74
|
function applyReplacers(doc) {
|
|
71
75
|
return doc.replace(replacerRegex, function (match, type, args) {
|
|
@@ -118,7 +122,7 @@ module.exports = function (options = {}) {
|
|
|
118
122
|
let classAdded = false;
|
|
119
123
|
|
|
120
124
|
md.renderer.rules.dl_open = function (tokens, idx, options, env, self) {
|
|
121
|
-
|
|
125
|
+
|
|
122
126
|
const targetHtml = 'terminology-section-start-h7vc6omi2hr2880';
|
|
123
127
|
let targetIndex = -1;
|
|
124
128
|
|
|
@@ -189,7 +193,7 @@ module.exports = function (options = {}) {
|
|
|
189
193
|
};
|
|
190
194
|
const spaceRegex = /\s+/g;
|
|
191
195
|
const specNameRegex = /^spec$|^spec[-]*\w+$/i;
|
|
192
|
-
const terminologyRegex = /^def$|^ref$|^xref
|
|
196
|
+
const terminologyRegex = /^def$|^ref$|^xref|^tref$/i;
|
|
193
197
|
const specCorpus = fs.readJsonSync(modulePath + '/assets/compiled/refs.json');
|
|
194
198
|
const containers = require('markdown-it-container');
|
|
195
199
|
const md = require('markdown-it')({
|
|
@@ -214,6 +218,9 @@ module.exports = function (options = {}) {
|
|
|
214
218
|
return `<a class="x-term-reference term-reference" data-local-href="#term:${token.info.args[0]}:${term}"
|
|
215
219
|
href="${url}#term:${term}">${token.info.args[1]}</a>`;
|
|
216
220
|
}
|
|
221
|
+
else if (type === 'tref') {
|
|
222
|
+
return `<span class="transcluded-xref-term" id="term:${token.info.args[1]}">${token.info.args[1]}</span>`;
|
|
223
|
+
}
|
|
217
224
|
else {
|
|
218
225
|
references.push(primary);
|
|
219
226
|
return `<a class="term-reference" href="#term:${primary.replace(spaceRegex, '-').toLowerCase()}">${primary}</a>`;
|
|
@@ -339,7 +346,7 @@ module.exports = function (options = {}) {
|
|
|
339
346
|
assetsSvg: assets.svg,
|
|
340
347
|
features: Object.keys(features).join(' '),
|
|
341
348
|
externalReferences: JSON.stringify(externalReferences),
|
|
342
|
-
|
|
349
|
+
xtrefsData: xtrefsData,
|
|
343
350
|
specLogo: spec.logo,
|
|
344
351
|
specFavicon: spec.favicon,
|
|
345
352
|
specLogoLink: spec.logo_link,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.82",
|
|
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
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"body": {
|
|
25
25
|
"js": [
|
|
26
26
|
"node_modules/markdown-it/dist/markdown-it.min.js",
|
|
27
|
+
"node_modules/markdown-it-deflist/dist/markdown-it-deflist.min.js",
|
|
27
28
|
"assets/js/prism.js",
|
|
28
29
|
"assets/js/mermaid.js",
|
|
29
30
|
"assets/js/chart.js",
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
"assets/js/create-alphabet-index.js",
|
|
47
48
|
"assets/js/collapse-definitions.js",
|
|
48
49
|
"assets/js/add-href-to-snapshot-link.js",
|
|
49
|
-
"assets/js/index.js"
|
|
50
|
+
"assets/js/index.js",
|
|
51
|
+
"assets/js/css-helper.js"
|
|
50
52
|
]
|
|
51
53
|
}
|
|
52
54
|
}
|
package/src/create-pdf.js
CHANGED
|
@@ -6,7 +6,12 @@ const pdfLib = require('pdf-lib');
|
|
|
6
6
|
(async () => {
|
|
7
7
|
try {
|
|
8
8
|
// Launch a new browser instance
|
|
9
|
+
// Production
|
|
9
10
|
const browser = await puppeteer.launch();
|
|
11
|
+
|
|
12
|
+
// Test
|
|
13
|
+
// const browser = await puppeteer.launch({ headless: false, devtools: true }); // Open DevTools automatically
|
|
14
|
+
|
|
10
15
|
const page = await browser.newPage();
|
|
11
16
|
|
|
12
17
|
// Read and parse the specs.json file
|
|
@@ -22,6 +27,29 @@ const pdfLib = require('pdf-lib');
|
|
|
22
27
|
// Navigate to the HTML file
|
|
23
28
|
await page.goto(fileUrl, { waitUntil: 'networkidle2' });
|
|
24
29
|
|
|
30
|
+
// this class will hold the text that we want to wait for (xref term fetched from another domain)
|
|
31
|
+
const targetClass = '.fetched-xref-term';
|
|
32
|
+
|
|
33
|
+
// Check if there are any elements with the target class
|
|
34
|
+
const hasTargetElements = await page.evaluate((targetClass) => {
|
|
35
|
+
return document.querySelectorAll(targetClass).length > 0;
|
|
36
|
+
}, targetClass);
|
|
37
|
+
|
|
38
|
+
// Fetch the initial innerText of the element
|
|
39
|
+
const targetElement = await page.$(targetClass);
|
|
40
|
+
const targetText = await page.evaluate(el => el.innerText, targetElement);
|
|
41
|
+
if (hasTargetElements) {
|
|
42
|
+
await page.waitForFunction(
|
|
43
|
+
(targetClass, targetText) => {
|
|
44
|
+
const element = document.querySelector(targetClass);
|
|
45
|
+
return element && element.innerText !== targetText;
|
|
46
|
+
},
|
|
47
|
+
{}, // You can specify additional options here if needed
|
|
48
|
+
targetClass,
|
|
49
|
+
targetText
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
25
53
|
// Inject CSS to set padding and enforce system fonts
|
|
26
54
|
await page.evaluate(() => {
|
|
27
55
|
const style = document.createElement('style');
|
|
@@ -55,7 +55,7 @@ function fixMarkdownFiles(directory) {
|
|
|
55
55
|
|
|
56
56
|
// Prepend `~ ` to lines that do not start with `[[def:` and are not blank, and do not already start with `~ `
|
|
57
57
|
for (let i = 0; i < newLines.length; i++) {
|
|
58
|
-
if (!newLines[i].startsWith('[[def:') && newLines[i].trim() !== '' && !newLines[i].startsWith('~ ')) {
|
|
58
|
+
if (!newLines[i].startsWith('[[def:') && !newLines[i].startsWith('[[tref:') && newLines[i].trim() !== '' && !newLines[i].startsWith('~ ')) {
|
|
59
59
|
newLines[i] = `~ ${newLines[i]}`;
|
|
60
60
|
modified = true;
|
|
61
61
|
}
|