diff --git a/LM7805/index.html b/LM7805/index.html
index 334b5bc..fb2d15e 100644
--- a/LM7805/index.html
+++ b/LM7805/index.html
@@ -435,8 +435,7 @@
if (!diagrams.length) {
return;
}
- const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default;
- const parser = new DOMParser();
+ const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default;
mermaid.initialize({
maxTextSize: 100000,
@@ -452,52 +451,39 @@
let _nextMermaidId = 0;
function makeMermaidImage(svg) {
- const img = document.createElement("img");
- const doc = parser.parseFromString(svg, "image/svg+xml");
- const svgEl = doc.querySelector("svg");
- const { maxWidth } = svgEl?.style || {};
- const firstTitle = doc.querySelector("title");
- const firstDesc = doc.querySelector("desc");
-
- img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`);
- if (maxWidth) {
- img.width = parseInt(maxWidth);
- }
- if (firstTitle) {
- img.setAttribute("alt", firstTitle.textContent);
- }
- if (firstDesc) {
- const caption = document.createElement("figcaption");
- caption.className = "sr-only";
- caption.textContent = firstDesc.textContent;
- return [img, caption];
+ const img = document.createElement('img');
+ const maxWidth = svg.match(/max-width: (\d+)/);
+ if (maxWidth && maxWidth[1]) {
+ const width = parseInt(maxWidth[1]);
+ if (width && !Number.isNaN(width) && Number.isFinite(width)) {
+ img.width = width;
+ }
}
- return [img];
+ img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`);
+ return img;
}
async function makeMermaidError(text) {
- let errorMessage = "";
+ let errorMessage = '';
try {
await mermaid.parse(text);
} catch (err) {
errorMessage = `${err}`;
}
- const result = document.createElement("details");
- result.className = 'jp-RenderedMermaid-Details';
- const summary = document.createElement("summary");
- summary.className = 'jp-RenderedMermaid-Summary';
- const pre = document.createElement("pre");
- const code = document.createElement("code");
+ const result = document.createElement('details');
+ const summary = document.createElement('summary');
+ const pre = document.createElement('pre');
+ const code = document.createElement('code');
code.innerText = text;
pre.appendChild(code);
summary.appendChild(pre);
result.appendChild(summary);
- const warning = document.createElement("pre");
+ const warning = document.createElement('pre');
warning.innerText = errorMessage;
result.appendChild(warning);
- return [result];
+ return result;
}
async function renderOneMarmaid(src) {
@@ -507,41 +493,30 @@
const el = document.createElement("div");
el.style.visibility = "hidden";
document.body.appendChild(el);
- let results = null;
- let output = null;
+ let result = null;
try {
const { svg } = await mermaid.render(id, raw, el);
- results = makeMermaidImage(svg);
- output = document.createElement("figure");
- results.map(output.appendChild, output);
+ result = makeMermaidImage(svg);
} catch (err) {
parent.classList.add("jp-mod-warning");
- results = await makeMermaidError(raw);
- output = results[0];
+ result = await makeMermaidError(raw);
} finally {
el.remove();
}
parent.classList.add("jp-RenderedMermaid");
- parent.appendChild(output);
+ parent.appendChild(result);
}
void Promise.all([...diagrams].map(renderOneMarmaid));
});
diff --git a/UA78L05/index.html b/UA78L05/index.html
index 77e7d67..dc6f30c 100644
--- a/UA78L05/index.html
+++ b/UA78L05/index.html
@@ -417,8 +417,7 @@
if (!diagrams.length) {
return;
}
- const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default;
- const parser = new DOMParser();
+ const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default;
mermaid.initialize({
maxTextSize: 100000,
@@ -434,52 +433,39 @@
let _nextMermaidId = 0;
function makeMermaidImage(svg) {
- const img = document.createElement("img");
- const doc = parser.parseFromString(svg, "image/svg+xml");
- const svgEl = doc.querySelector("svg");
- const { maxWidth } = svgEl?.style || {};
- const firstTitle = doc.querySelector("title");
- const firstDesc = doc.querySelector("desc");
-
- img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`);
- if (maxWidth) {
- img.width = parseInt(maxWidth);
- }
- if (firstTitle) {
- img.setAttribute("alt", firstTitle.textContent);
- }
- if (firstDesc) {
- const caption = document.createElement("figcaption");
- caption.className = "sr-only";
- caption.textContent = firstDesc.textContent;
- return [img, caption];
+ const img = document.createElement('img');
+ const maxWidth = svg.match(/max-width: (\d+)/);
+ if (maxWidth && maxWidth[1]) {
+ const width = parseInt(maxWidth[1]);
+ if (width && !Number.isNaN(width) && Number.isFinite(width)) {
+ img.width = width;
+ }
}
- return [img];
+ img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`);
+ return img;
}
async function makeMermaidError(text) {
- let errorMessage = "";
+ let errorMessage = '';
try {
await mermaid.parse(text);
} catch (err) {
errorMessage = `${err}`;
}
- const result = document.createElement("details");
- result.className = 'jp-RenderedMermaid-Details';
- const summary = document.createElement("summary");
- summary.className = 'jp-RenderedMermaid-Summary';
- const pre = document.createElement("pre");
- const code = document.createElement("code");
+ const result = document.createElement('details');
+ const summary = document.createElement('summary');
+ const pre = document.createElement('pre');
+ const code = document.createElement('code');
code.innerText = text;
pre.appendChild(code);
summary.appendChild(pre);
result.appendChild(summary);
- const warning = document.createElement("pre");
+ const warning = document.createElement('pre');
warning.innerText = errorMessage;
result.appendChild(warning);
- return [result];
+ return result;
}
async function renderOneMarmaid(src) {
@@ -489,41 +475,30 @@
const el = document.createElement("div");
el.style.visibility = "hidden";
document.body.appendChild(el);
- let results = null;
- let output = null;
+ let result = null;
try {
const { svg } = await mermaid.render(id, raw, el);
- results = makeMermaidImage(svg);
- output = document.createElement("figure");
- results.map(output.appendChild, output);
+ result = makeMermaidImage(svg);
} catch (err) {
parent.classList.add("jp-mod-warning");
- results = await makeMermaidError(raw);
- output = results[0];
+ result = await makeMermaidError(raw);
} finally {
el.remove();
}
parent.classList.add("jp-RenderedMermaid");
- parent.appendChild(output);
+ parent.appendChild(result);
}
void Promise.all([...diagrams].map(renderOneMarmaid));
});
diff --git a/XL741/index.html b/XL741/index.html
index d3b6d52..8b3c244 100644
--- a/XL741/index.html
+++ b/XL741/index.html
@@ -427,8 +427,7 @@
if (!diagrams.length) {
return;
}
- const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default;
- const parser = new DOMParser();
+ const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default;
mermaid.initialize({
maxTextSize: 100000,
@@ -444,52 +443,39 @@
let _nextMermaidId = 0;
function makeMermaidImage(svg) {
- const img = document.createElement("img");
- const doc = parser.parseFromString(svg, "image/svg+xml");
- const svgEl = doc.querySelector("svg");
- const { maxWidth } = svgEl?.style || {};
- const firstTitle = doc.querySelector("title");
- const firstDesc = doc.querySelector("desc");
-
- img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`);
- if (maxWidth) {
- img.width = parseInt(maxWidth);
- }
- if (firstTitle) {
- img.setAttribute("alt", firstTitle.textContent);
- }
- if (firstDesc) {
- const caption = document.createElement("figcaption");
- caption.className = "sr-only";
- caption.textContent = firstDesc.textContent;
- return [img, caption];
+ const img = document.createElement('img');
+ const maxWidth = svg.match(/max-width: (\d+)/);
+ if (maxWidth && maxWidth[1]) {
+ const width = parseInt(maxWidth[1]);
+ if (width && !Number.isNaN(width) && Number.isFinite(width)) {
+ img.width = width;
+ }
}
- return [img];
+ img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`);
+ return img;
}
async function makeMermaidError(text) {
- let errorMessage = "";
+ let errorMessage = '';
try {
await mermaid.parse(text);
} catch (err) {
errorMessage = `${err}`;
}
- const result = document.createElement("details");
- result.className = 'jp-RenderedMermaid-Details';
- const summary = document.createElement("summary");
- summary.className = 'jp-RenderedMermaid-Summary';
- const pre = document.createElement("pre");
- const code = document.createElement("code");
+ const result = document.createElement('details');
+ const summary = document.createElement('summary');
+ const pre = document.createElement('pre');
+ const code = document.createElement('code');
code.innerText = text;
pre.appendChild(code);
summary.appendChild(pre);
result.appendChild(summary);
- const warning = document.createElement("pre");
+ const warning = document.createElement('pre');
warning.innerText = errorMessage;
result.appendChild(warning);
- return [result];
+ return result;
}
async function renderOneMarmaid(src) {
@@ -499,41 +485,30 @@
const el = document.createElement("div");
el.style.visibility = "hidden";
document.body.appendChild(el);
- let results = null;
- let output = null;
+ let result = null;
try {
const { svg } = await mermaid.render(id, raw, el);
- results = makeMermaidImage(svg);
- output = document.createElement("figure");
- results.map(output.appendChild, output);
+ result = makeMermaidImage(svg);
} catch (err) {
parent.classList.add("jp-mod-warning");
- results = await makeMermaidError(raw);
- output = results[0];
+ result = await makeMermaidError(raw);
} finally {
el.remove();
}
parent.classList.add("jp-RenderedMermaid");
- parent.appendChild(output);
+ parent.appendChild(result);
}
void Promise.all([...diagrams].map(renderOneMarmaid));
});
@@ -691,7 +651,7 @@
Full and simplified schematic
-
+
@@ -1385,9 +1345,10 @@
-
ng.cmd('alter vin -565.7u')
+ng.cmd('alter vin DC -565.7u')
print_op()
-ng.cmd('alter vin -565.7u')
+
ng.cmd('alter vin DC -565.7u')
print_op()
@@ -1899,6 +1860,141 @@
Input offset and open loop gain
+