spec-up-t 1.1.32 → 1.1.33

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.
@@ -134,7 +134,7 @@ function tokenInput(){let t=document.createElement("button");t.classList.add("bu
134
134
  function pdfDownload(){fetch("index.pdf",{method:"HEAD"}).then(e=>{if(e.ok){let e=document.createElement("a");e.classList.add("button-pdf-download"),e.classList.add("btn"),e.target="_blank",e.rel="noopener noreferrer",e.href="index.pdf",e.title="Download this page as a PDF",e.innerHTML="PDF",document.querySelector("#container-search-h7vc6omi2hr2880").appendChild(e)}else console.log("PDF file does not exist. No PDF download button will be added.")}).catch(e=>{console.error("Error checking PDF file:",e)})}document.addEventListener("DOMContentLoaded",(function(){pdfDownload()}));
135
135
  function helpButtons(){const t=document.createElement("a");t.textContent="?",t.classList.add("help-button","btn"),t.title="Click to see the explanation of the buttons at the documentation website, in a new tab.",t.target="_blank",t.rel="noopener noreferrer",t.href="https://trustoverip.github.io/spec-up-t-website/docs/user-interface-overview/specification#explanation-of-the-buttons-in-the-specification",function(t){document.querySelectorAll("#content dl dt").forEach(e=>{e.appendChild(t.cloneNode(!0))})}(t)}document.addEventListener("DOMContentLoaded",helpButtons);
136
136
  function collapseDefinitions(){const t=document.querySelectorAll("#content dl.terms-and-definitions-list > dd"),e=document.querySelectorAll("#content dl.terms-and-definitions-list > dt"),n=document.querySelectorAll(".collapse-all-defs-button");e.forEach(t=>{const e=document.createElement("button");e.classList.add("collapse-all-defs-button","btn"),e.innerHTML="▲",e.setAttribute("id","toggleButton"),t.appendChild(e)}),document.addEventListener("click",e=>{e.target.classList.contains("collapse-all-defs-button")&&(!function(){const e=t[0].classList.contains("hidden");t.forEach(t=>{t.classList.toggle("hidden",!e),t.classList.toggle("visible",e)}),n.forEach(t=>{t.innerHTML=e?"▲":"▼",t.title=e?"Collapse all definitions":"Expand all definitions"})}(),e.target.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}),setTimeout(()=>{window.scrollBy({top:-100,behavior:"smooth"})},500))})}document.addEventListener("DOMContentLoaded",(function(){collapseDefinitions()}));
137
- function createToggleButton(t){const e=document.createElement("button");e.classList.add("meta-info-toggle-button","btn"),e.textContent="🔍",e.title="Meta info",e.addEventListener("click",(function(){t.classList.toggle("collapsed"),t.classList.contains("collapsed"),this.textContent="🔍"}));let n=t.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?n.appendChild(e):t.insertBefore(e,t.firstChild)}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".contains-table").forEach((function(t){const e=document.createElement("div");for(e.classList.add("meta-info-content-wrapper");t.firstChild&&t.firstChild!==t.querySelector(".meta-info-toggle-button");)e.appendChild(t.firstChild);t.querySelector(".meta-info-toggle-button")||createToggleButton(t),t.appendChild(e),t.classList.add("collapsed")}))}));
137
+ function createToggleButton(t){const e=document.createElement("button");e.classList.add("meta-info-toggle-button","btn"),e.textContent="ℹ️",e.title="Meta info",e.addEventListener("click",(function(){t.classList.toggle("collapsed"),t.classList.contains("collapsed"),this.textContent="ℹ️"}));let n=t.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?n.appendChild(e):t.insertBefore(e,t.firstChild)}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("dl > dd:has(table)").forEach((function(t){const e=document.createElement("div");for(e.classList.add("meta-info-content-wrapper");t.firstChild&&t.firstChild!==t.querySelector(".meta-info-toggle-button");)e.appendChild(t.firstChild);t.querySelector(".meta-info-toggle-button")||createToggleButton(t),t.appendChild(e),t.classList.add("collapsed")}))}));
138
138
  /**
139
139
  * @file This file adds an href attribute to the snapshot link on the page via client side JS DOM manipulation.
140
140
  * @author Kor Dwarshuis
@@ -8,7 +8,7 @@ code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-fami
8
8
  #back-to-top-a1zncgtqfpzsig8{position:fixed;bottom:20px;text-decoration:none;left:calc(100% - 1.8em);width:1.5em;height:1.5em;margin:0;padding:0;background-color:#1e6eae;color:#222;border-radius:50px;text-align:center;font-size:30px;color:#fff;box-shadow:0 0 1.3px rgba(0,0,0,.07),0 0 3.6px rgba(0,0,0,.1),0 0 8.7px rgba(0,0,0,.13),0 0 29px rgba(0,0,0,.2);cursor:pointer;border:none;display:none;align-items:center;justify-content:center}
9
9
  @-webkit-keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@-webkit-keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@-webkit-keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@-webkit-keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@-webkit-keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}@keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}.notyf{position:fixed;top:0;left:0;height:100%;width:100%;color:#fff;z-index:9999;display:flex;flex-direction:column;align-items:flex-end;justify-content:flex-end;pointer-events:none;box-sizing:border-box;padding:20px}.notyf__icon--error,.notyf__icon--success{height:21px;width:21px;background:#fff;border-radius:50%;display:block;margin:0 auto;position:relative}.notyf__icon--error:after,.notyf__icon--error:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px;left:9px;height:12px;top:5px}.notyf__icon--error:after{transform:rotate(-45deg)}.notyf__icon--error:before{transform:rotate(45deg)}.notyf__icon--success:after,.notyf__icon--success:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px}.notyf__icon--success:after{height:6px;transform:rotate(-45deg);top:9px;left:6px}.notyf__icon--success:before{height:11px;transform:rotate(45deg);top:5px;left:10px}.notyf__toast{display:block;overflow:hidden;pointer-events:auto;-webkit-animation:notyf-fadeinup .3s ease-in forwards;animation:notyf-fadeinup .3s ease-in forwards;box-shadow:0 3px 7px 0 rgba(0,0,0,.25);position:relative;padding:0 15px;border-radius:2px;max-width:300px;transform:translateY(25%);box-sizing:border-box;flex-shrink:0}.notyf__toast--disappear{transform:translateY(0);-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s}.notyf__toast--disappear .notyf__icon,.notyf__toast--disappear .notyf__message{-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;opacity:1;transform:translateY(0)}.notyf__toast--disappear .notyf__dismiss{-webkit-animation:notyf-fadeoutright .3s forwards;animation:notyf-fadeoutright .3s forwards;opacity:1;transform:translateX(0)}.notyf__toast--disappear .notyf__message{-webkit-animation-delay:.05s;animation-delay:.05s}.notyf__toast--upper{margin-bottom:20px}.notyf__toast--lower{margin-top:20px}.notyf__toast--dismissible .notyf__wrapper{padding-right:30px}.notyf__ripple{height:400px;width:400px;position:absolute;transform-origin:bottom right;right:0;top:0;border-radius:50%;transform:scale(0) translateY(-51%) translateX(13%);z-index:5;-webkit-animation:ripple .4s ease-out forwards;animation:ripple .4s ease-out forwards}.notyf__wrapper{display:flex;align-items:center;padding-top:17px;padding-bottom:17px;padding-right:15px;border-radius:3px;position:relative;z-index:10}.notyf__icon{width:22px;text-align:center;font-size:1.3em;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.3s;animation-delay:.3s;margin-right:13px}.notyf__dismiss{position:absolute;top:0;right:0;height:100%;width:26px;margin-right:-15px;-webkit-animation:notyf-fadeinleft .3s forwards;animation:notyf-fadeinleft .3s forwards;-webkit-animation-delay:.35s;animation-delay:.35s;opacity:0}.notyf__dismiss-btn{background-color:rgba(0,0,0,.25);border:none;cursor:pointer;transition:opacity .2s ease,background-color .2s ease;outline:0;opacity:.35;height:100%;width:100%}.notyf__dismiss-btn:after,.notyf__dismiss-btn:before{content:"";background:#fff;height:12px;width:2px;border-radius:3px;position:absolute;left:calc(50% - 1px);top:calc(50% - 5px)}.notyf__dismiss-btn:after{transform:rotate(-45deg)}.notyf__dismiss-btn:before{transform:rotate(45deg)}.notyf__dismiss-btn:hover{opacity:.7;background-color:rgba(0,0,0,.15)}.notyf__dismiss-btn:active{opacity:.8}.notyf__message{vertical-align:middle;position:relative;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s;line-height:1.5em}@media only screen and (max-width:480px){.notyf{padding:0}.notyf__ripple{height:600px;width:600px;-webkit-animation-duration:.5s;animation-duration:.5s}.notyf__toast{max-width:none;border-radius:0;box-shadow:0 -2px 7px 0 rgba(0,0,0,.13);width:100%}.notyf__dismiss{width:56px}}
10
10
  #content dl dd.hidden{display:none}#content dl dd.visible{display:block}.collapse-all-defs-button{float:right}
11
- .contains-table>.meta-info-content-wrapper{max-height:100px;transition:max-height .3s ease-out}.contains-table.collapsed>.meta-info-content-wrapper{padding-top:0;padding-bottom:0;overflow:hidden;transition:max-height .3s ease-out;max-height:0}
11
+ dl>dd:has(table)>.meta-info-content-wrapper{max-height:100px;transition:max-height .3s ease-out}dl>dd:has(table).collapsed>.meta-info-content-wrapper{padding-top:0;padding-bottom:0;overflow:hidden;transition:max-height .3s ease-out;max-height:0}
12
12
  .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}
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:20px;line-height:20px;margin:2px;text-align:center;text-decoration:none;width:20px}
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)}
@@ -4,13 +4,13 @@
4
4
  Description: Make the meta-info tables collapsible
5
5
  */
6
6
 
7
- .contains-table>.meta-info-content-wrapper {
7
+ dl>dd:has(table)>.meta-info-content-wrapper {
8
8
  max-height: 100px;
9
9
  transition: max-height 0.3s ease-out;
10
10
  /* This should be higher than the tallest content */
11
11
  }
12
12
 
13
- .contains-table.collapsed>.meta-info-content-wrapper {
13
+ dl>dd:has(table).collapsed>.meta-info-content-wrapper {
14
14
  padding-top: 0;
15
15
  padding-bottom: 0;
16
16
 
@@ -9,16 +9,16 @@
9
9
  function createToggleButton(element) {
10
10
  const toggleButton = document.createElement('button');
11
11
  toggleButton.classList.add('meta-info-toggle-button', 'btn');
12
- toggleButton.textContent = '🔍';
12
+ toggleButton.textContent = 'ℹ️';
13
13
  toggleButton.title = 'Meta info';
14
14
 
15
15
  // Add event listener to the button
16
16
  toggleButton.addEventListener('click', function () {
17
17
  element.classList.toggle('collapsed');
18
18
  if (element.classList.contains('collapsed')) {
19
- this.textContent = '🔍';
19
+ this.textContent = 'ℹ️';
20
20
  } else {
21
- this.textContent = '🔍';
21
+ this.textContent = 'ℹ️';
22
22
  }
23
23
  });
24
24
 
@@ -37,7 +37,7 @@ function createToggleButton(element) {
37
37
 
38
38
  // Find all elements with class 'collapsible' and make them collapsible
39
39
  document.addEventListener('DOMContentLoaded', function () {
40
- const collapsibles = document.querySelectorAll('.contains-table');
40
+ const collapsibles = document.querySelectorAll('dl > dd:has(table)');
41
41
 
42
42
  collapsibles.forEach(function (element) {
43
43
  // Wrap content (excluding button) in a div for easy toggling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
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": {
@@ -53,9 +53,15 @@ function fixMarkdownFiles(directory) {
53
53
  }
54
54
  }
55
55
 
56
- // Prepend `~ ` to lines that do not start with `[[def:` and are not blank, and do not already start with `~ `
56
+ // Prepend `~ ` to lines that do not start with `[[def:`, `[[tref:`, are not blank, do not already start with `~ `, and are not HTML comments
57
57
  for (let i = 0; i < newLines.length; i++) {
58
- if (!newLines[i].startsWith('[[def:') && !newLines[i].startsWith('[[tref:') && newLines[i].trim() !== '' && !newLines[i].startsWith('~ ')) {
58
+ if (
59
+ !newLines[i].startsWith('[[def:') &&
60
+ !newLines[i].startsWith('[[tref:') &&
61
+ newLines[i].trim() !== '' &&
62
+ !newLines[i].startsWith('~ ') &&
63
+ !newLines[i].trim().startsWith('<!--')
64
+ ) {
59
65
  newLines[i] = `~ ${newLines[i]}`;
60
66
  modified = true;
61
67
  }
@@ -1,11 +1,22 @@
1
1
  /**
2
2
  * @file prepare-tref.js
3
- * @description This script contains functions to process and prepare term references (trefs) from markdown files.
4
- * It includes functionality to read local xtref content from a JSON file and process markdown files in a directory recursively. This script inserts the content of the local xtref (in JSON) into the markdown files. It also inserts a note that this content is temporary and can be removed.
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.
5
18
  *
6
19
  * @module prepareTref
7
- * @requires fs
8
- * @requires path
9
20
  */
10
21
 
11
22
  const fs = require('fs');
@@ -54,8 +65,7 @@ function prepareTref(directory) {
54
65
 
55
66
  // Split the content into lines
56
67
  let lines = data.split('\n');
57
- let localXTrefContent = '';
58
- // Handle specific functionality for `[[tref:` lines
68
+
59
69
  for (let i = 0; i < lines.length; i++) {
60
70
  if (lines[i].startsWith('[[tref:')) {
61
71
 
@@ -74,34 +84,19 @@ function prepareTref(directory) {
74
84
  const match = lines[i].match(tref);
75
85
  if (match) {
76
86
  const result = match[1].split(',').map(term => term.trim());
77
- localXTrefContent = getLocalXTrefContent(result[0], result[1]);
78
- /*
79
-
80
- Remove the `[[def: ...]]:` lines from the content.
81
-
82
- \[\[def: matches the literal [[def:
83
-
84
- .*? lazily matches any character(including commas) until the next part of the regex.
85
-
86
- \]\]: matches the literal ]]:.
87
-
88
- The g flag ensures that all occurrences in the string are replaced.
89
- */
90
- // const defPart = /\[\[def: .*?\]\]:/g;
91
- const defPart = /\[\[def: ([^,]+),.*?\]\]/g;
87
+ const localXTrefContent = getLocalXTrefContent(result[0], result[1]);
92
88
 
89
+ const defPart = /\[\[def: ([^,]+),.*?\]\]/g;
93
90
  localXTrefContent.content = localXTrefContent.content.replace(defPart, '');
94
91
 
95
92
  const readyForWrite = dedent`
96
93
  ${match[0]}
97
- <!-- This is a copy of the saved remote text. Remove it if you like. It is automatically (re)generated -->
98
- <dd>
99
94
  | Property | Value |
100
95
  | -------- | ----- |
101
96
  | Owner | ![avatar](${localXTrefContent.avatarUrl}) ${localXTrefContent.owner} |
102
97
  | Repo | [${localXTrefContent.repo}](${localXTrefContent.repoUrl}) |
103
98
  | Commit hash | ${localXTrefContent.commitHash} |
104
- </dd>
99
+
105
100
  ${localXTrefContent.content}
106
101
  `;
107
102
 
@@ -110,8 +105,7 @@ ${localXTrefContent.content}
110
105
  }
111
106
  }
112
107
  } catch (err) {
113
- fs.writeFileSync(itemPath, match[0] + '\n\n' + '<!-- This is a copy of the saved remote text. Remove it if you like. It is automatically (re)generated -->\n\nNothing found, so nothing to show.', 'utf8');
114
- // console.error(`❌ Error reading or writing file ${item.name}: ${err}`);
108
+ fs.writeFileSync(itemPath, match[0] + '\n\n' + '\n\nNothing found, so nothing to show.', 'utf8');
115
109
  }
116
110
  }
117
111
  });
@@ -120,10 +114,9 @@ ${localXTrefContent.content}
120
114
  }
121
115
  }
122
116
 
123
- // Start processing from the given directory
124
117
  processDirectory(directory);
125
118
  }
126
119
 
127
120
  module.exports = {
128
121
  prepareTref
129
- };
122
+ };