@pretextbook/pretext-html 0.7.0 → 0.8.0
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/README.md +31 -2
- package/assets/upstream.json +1 -1
- package/assets/xsl/README.md +25 -24
- package/assets/xsl/entities.ent +11 -0
- package/assets/xsl/localizations/README.md +24 -24
- package/assets/xsl/pretext-assembly.xsl +2 -6
- package/assets/xsl/pretext-common.xsl +19 -2
- package/assets/xsl/pretext-epub.xsl +4 -1
- package/assets/xsl/pretext-fo.xsl +17 -19
- package/assets/xsl/pretext-html.xsl +203 -40
- package/assets/xsl/pretext-latex-common.xsl +28 -17
- package/assets/xsl/pretext-revealjs.xsl +1 -3
- package/assets/xsl/pretext-runestone.xsl +5 -21
- package/assets/xsl/publisher-variables.xsl +70 -111
- package/assets/xsl/support/play-button/README.md +1 -3
- package/assets/xsl/tests/README.md +1 -1
- package/assets/xsl/utilities/README.md +6 -8
- package/assets/xsl-bundle.json +1 -1
- package/dist/{cli-D0m0Ha1j.js → cli-Bcn4t3B1.js} +233 -218
- package/dist/cli.js +1 -1
- package/dist/html-static.d.ts +20 -0
- package/dist/index.browser.js +265 -250
- package/dist/index.js +1 -1
- package/dist/renderer.d.ts +5 -1
- package/package.json +2 -1
package/dist/index.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fromXml as x } from "xast-util-from-xml";
|
|
2
|
-
import { toXml as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
2
|
+
import { toXml as S } from "xast-util-to-xml";
|
|
3
|
+
const A = "/";
|
|
4
|
+
function ye(e) {
|
|
5
5
|
if (!e)
|
|
6
6
|
return ".";
|
|
7
7
|
const n = e.startsWith("/"), t = e.length > 1 && e.endsWith("/"), r = [];
|
|
@@ -25,7 +25,7 @@ function p(...e) {
|
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
n.startsWith("/") || (n = `/${n}`);
|
|
28
|
-
const t =
|
|
28
|
+
const t = ye(n);
|
|
29
29
|
return t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
30
30
|
}
|
|
31
31
|
function g(e) {
|
|
@@ -35,28 +35,28 @@ function g(e) {
|
|
|
35
35
|
const t = n.lastIndexOf("/");
|
|
36
36
|
return t < 0 ? "." : t === 0 ? "/" : n.slice(0, t);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function k(e, n) {
|
|
39
39
|
const t = p(e).split("/").filter(Boolean), r = p(n).split("/").filter(Boolean);
|
|
40
40
|
let i = 0;
|
|
41
41
|
for (; i < t.length && i < r.length && t[i] === r[i]; )
|
|
42
42
|
i += 1;
|
|
43
43
|
return [...new Array(t.length - i).fill(".."), ...r.slice(i)].join("/");
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const xe = "ptxPreviewBannerDismissed", Ee = "About live preview";
|
|
46
46
|
function X(e) {
|
|
47
47
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Te(e) {
|
|
50
50
|
return [
|
|
51
51
|
'<div id="ptx-preview-banner" class="ptx-preview-banner" role="note">',
|
|
52
52
|
` <span class="ptx-preview-banner-text">${X(e)}</span>`,
|
|
53
53
|
' <button type="button" class="ptx-preview-banner-dismiss" aria-label="Dismiss">×</button>',
|
|
54
54
|
"</div>",
|
|
55
|
-
`<button type="button" id="ptx-preview-banner-restore" class="ptx-preview-banner-restore" hidden>${X(
|
|
55
|
+
`<button type="button" id="ptx-preview-banner-restore" class="ptx-preview-banner-restore" hidden>${X(Ee)}</button>`
|
|
56
56
|
].join(`
|
|
57
57
|
`);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Se() {
|
|
60
60
|
return [
|
|
61
61
|
"<style>",
|
|
62
62
|
".ptx-preview-banner {",
|
|
@@ -121,7 +121,7 @@ function $e() {
|
|
|
121
121
|
return [
|
|
122
122
|
"<script>",
|
|
123
123
|
"(function () {",
|
|
124
|
-
" var KEY = " + JSON.stringify(
|
|
124
|
+
" var KEY = " + JSON.stringify(xe) + ";",
|
|
125
125
|
' var banner = document.getElementById("ptx-preview-banner");',
|
|
126
126
|
' var restore = document.getElementById("ptx-preview-banner-restore");',
|
|
127
127
|
" if (!banner || !restore) { return; }",
|
|
@@ -158,39 +158,39 @@ function $e() {
|
|
|
158
158
|
].join(`
|
|
159
159
|
`);
|
|
160
160
|
}
|
|
161
|
-
const
|
|
162
|
-
function
|
|
163
|
-
const t =
|
|
161
|
+
const _e = "<!--ptx-preview-banner-->", Ie = "<!--/ptx-preview-banner-->", Re = /\n?<!--ptx-preview-banner-->[\s\S]*?<!--\/ptx-preview-banner-->/;
|
|
162
|
+
function ke(e, n) {
|
|
163
|
+
const t = Re.exec(e), r = t ? e.slice(0, t.index) + e.slice(t.index + t[0].length) : e;
|
|
164
164
|
if (!/<body[^>]*>/i.test(r))
|
|
165
165
|
return r;
|
|
166
166
|
const i = `
|
|
167
|
-
${
|
|
168
|
-
${
|
|
169
|
-
${
|
|
167
|
+
${_e}
|
|
168
|
+
${Se()}
|
|
169
|
+
${Te(n.message)}
|
|
170
170
|
${$e()}
|
|
171
|
-
${
|
|
171
|
+
${Ie}`;
|
|
172
172
|
return r.replace(/<body([^>]*)>/i, `<body$1>${i}`);
|
|
173
173
|
}
|
|
174
|
-
const De = "https://cdn.jsdelivr.net/npm/@pretextbook/pretext-html@0.
|
|
174
|
+
const De = "https://cdn.jsdelivr.net/npm/@pretextbook/pretext-html@0.8.0/assets";
|
|
175
175
|
let ee;
|
|
176
|
-
function
|
|
176
|
+
function Ft(e) {
|
|
177
177
|
ee = e.replace(/\/+$/, "");
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function $() {
|
|
180
180
|
return ee ?? De;
|
|
181
181
|
}
|
|
182
182
|
function te(e, n) {
|
|
183
183
|
return `${e.replace(/\/+$/, "")}/${n.replace(/^\/+/, "")}`;
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
185
|
+
const V = /* @__PURE__ */ new Map();
|
|
186
|
+
function Me(e) {
|
|
187
187
|
return `${e.replace(/\/+$/, "")}-bundle.json`;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
let n =
|
|
189
|
+
function Le(e) {
|
|
190
|
+
let n = V.get(e);
|
|
191
191
|
return n || (n = (async () => {
|
|
192
192
|
try {
|
|
193
|
-
const t = await fetch(
|
|
193
|
+
const t = await fetch(Me(e));
|
|
194
194
|
if (!t.ok)
|
|
195
195
|
return /* @__PURE__ */ new Map();
|
|
196
196
|
const r = await t.json();
|
|
@@ -198,14 +198,14 @@ function Me(e) {
|
|
|
198
198
|
} catch {
|
|
199
199
|
return /* @__PURE__ */ new Map();
|
|
200
200
|
}
|
|
201
|
-
})(),
|
|
201
|
+
})(), V.set(e, n)), n;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
return e === te(
|
|
203
|
+
function Ae(e) {
|
|
204
|
+
return e === te($(), "xsl");
|
|
205
205
|
}
|
|
206
206
|
async function ne(e, n) {
|
|
207
|
-
if (
|
|
208
|
-
const s = (await
|
|
207
|
+
if (Ae(e)) {
|
|
208
|
+
const s = (await Le(e)).get(n.replace(/^\/+/, ""));
|
|
209
209
|
if (s !== void 0)
|
|
210
210
|
return new TextEncoder().encode(s);
|
|
211
211
|
}
|
|
@@ -229,7 +229,7 @@ async function ne(e, n) {
|
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
async function
|
|
232
|
+
async function C(e) {
|
|
233
233
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(e))
|
|
234
234
|
try {
|
|
235
235
|
const n = await fetch(e);
|
|
@@ -238,35 +238,42 @@ async function B(e) {
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
const
|
|
242
|
-
|
|
241
|
+
const re = "2.46.0", je = "8.2.1", Be = [
|
|
242
|
+
"prefix-runtime.ed2cce180827a7ad.bundle.js",
|
|
243
|
+
"prefix-926.5c7038c8ef173faf.bundle.js",
|
|
244
|
+
"prefix-runestone.1f660864c47fc762.bundle.js"
|
|
245
|
+
], Ce = [
|
|
246
|
+
"prefix-926.229729d09512acc9.css",
|
|
247
|
+
"prefix-runestone.8086b62682b271d1.css"
|
|
248
|
+
], Oe = "born-hidden-knowl", Pe = /<details\b([^>]*)>(\s*)(?:<summary\b([^>]*)>)?/g;
|
|
249
|
+
function Ne(e) {
|
|
243
250
|
const n = /\bclass="([^"]*)"/.exec(e);
|
|
244
251
|
return n ? n[1].trim().split(/\s+/) : [];
|
|
245
252
|
}
|
|
246
|
-
function
|
|
253
|
+
function Fe(e) {
|
|
247
254
|
return /(^|\s)open(\s|=|$)/.test(e);
|
|
248
255
|
}
|
|
249
|
-
function
|
|
250
|
-
return
|
|
256
|
+
function z(e) {
|
|
257
|
+
return Fe(e) ? e : ` open${e}`;
|
|
251
258
|
}
|
|
252
|
-
function
|
|
259
|
+
function We(e) {
|
|
253
260
|
return e.replace(
|
|
254
|
-
|
|
261
|
+
Pe,
|
|
255
262
|
(n, t, r, i) => {
|
|
256
|
-
if (!
|
|
263
|
+
if (!Ne(t).includes(Oe))
|
|
257
264
|
return n;
|
|
258
|
-
const s = `<details${
|
|
259
|
-
return i === void 0 ? `${s}${r}` : `${s}${r}<summary${
|
|
265
|
+
const s = `<details${z(t)}>`;
|
|
266
|
+
return i === void 0 ? `${s}${r}` : `${s}${r}<summary${z(i)}>`;
|
|
260
267
|
}
|
|
261
268
|
);
|
|
262
269
|
}
|
|
263
|
-
const
|
|
264
|
-
let
|
|
265
|
-
function
|
|
266
|
-
|
|
270
|
+
const O = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Map();
|
|
271
|
+
let j, Ue = 0, se = ne;
|
|
272
|
+
function Wt(e) {
|
|
273
|
+
se = e;
|
|
267
274
|
}
|
|
268
|
-
function
|
|
269
|
-
const t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r =
|
|
275
|
+
function He(e, n) {
|
|
276
|
+
const t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r = ie.get(t);
|
|
270
277
|
if (r !== void 0)
|
|
271
278
|
return Promise.resolve(new Response(r, { status: 200 }));
|
|
272
279
|
let i;
|
|
@@ -275,32 +282,32 @@ function We(e, n) {
|
|
|
275
282
|
} catch {
|
|
276
283
|
i = "";
|
|
277
284
|
}
|
|
278
|
-
const s =
|
|
279
|
-
return s !== void 0 ?
|
|
285
|
+
const s = O.get(i);
|
|
286
|
+
return s !== void 0 ? Ve(s, t) : j(e, n);
|
|
280
287
|
}
|
|
281
|
-
const
|
|
282
|
-
async function
|
|
283
|
-
const t = decodeURIComponent(new URL(n).pathname), r = await
|
|
288
|
+
const Xe = '<?xml version="1.0"?><pretext-preview-missing-file/>';
|
|
289
|
+
async function Ve(e, n) {
|
|
290
|
+
const t = decodeURIComponent(new URL(n).pathname), r = await se(e, t);
|
|
284
291
|
if (r === void 0)
|
|
285
|
-
return new Response(
|
|
292
|
+
return new Response(Xe, { status: 200 });
|
|
286
293
|
const i = typeof r == "string" ? r : new Uint8Array(r);
|
|
287
294
|
return new Response(i, { status: 200 });
|
|
288
295
|
}
|
|
289
|
-
function
|
|
290
|
-
|
|
296
|
+
function oe() {
|
|
297
|
+
j || (j = globalThis.fetch, globalThis.fetch = He);
|
|
291
298
|
}
|
|
292
|
-
function
|
|
293
|
-
|
|
294
|
-
const n = `mnt${++
|
|
295
|
-
return
|
|
299
|
+
function ae(e) {
|
|
300
|
+
oe();
|
|
301
|
+
const n = `mnt${++Ue}.ptx.invalid`;
|
|
302
|
+
return O.set(n, e), `http://${n}`;
|
|
296
303
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
304
|
+
function ze(e) {
|
|
305
|
+
O.delete(new URL(e).host);
|
|
299
306
|
}
|
|
300
|
-
function
|
|
301
|
-
|
|
307
|
+
function Je(e, n) {
|
|
308
|
+
oe(), ie.set(e, n);
|
|
302
309
|
}
|
|
303
|
-
const
|
|
310
|
+
const B = `<?xml version="1.0" encoding="UTF-8"?>
|
|
304
311
|
<publication>
|
|
305
312
|
<source>
|
|
306
313
|
<directories external="../assets" generated="../generated-assets" />
|
|
@@ -309,62 +316,62 @@ const A = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
309
316
|
<platform portable="yes"/>
|
|
310
317
|
</html>
|
|
311
318
|
</publication>
|
|
312
|
-
`,
|
|
313
|
-
function
|
|
319
|
+
`, Ke = ["theme", "style", "shell"];
|
|
320
|
+
function v(e, n) {
|
|
314
321
|
for (const t of e.children)
|
|
315
322
|
if (t.type === "element" && t.name === n)
|
|
316
323
|
return t;
|
|
317
324
|
}
|
|
318
|
-
function
|
|
319
|
-
let t =
|
|
325
|
+
function b(e, n) {
|
|
326
|
+
let t = v(e, n);
|
|
320
327
|
return t || (t = { type: "element", name: n, attributes: {}, children: [] }, e.children.push(t)), t;
|
|
321
328
|
}
|
|
322
|
-
function
|
|
323
|
-
const t =
|
|
324
|
-
if (t &&
|
|
329
|
+
function Ge(e, n) {
|
|
330
|
+
const t = v(e, "css");
|
|
331
|
+
if (t && Ke.some((i) => t.attributes?.[i]))
|
|
325
332
|
return;
|
|
326
|
-
const r = t ??
|
|
333
|
+
const r = t ?? b(e, "css");
|
|
327
334
|
r.attributes = { ...r.attributes, theme: n };
|
|
328
335
|
}
|
|
329
|
-
function
|
|
330
|
-
const t =
|
|
336
|
+
function Ye(e, n) {
|
|
337
|
+
const t = v(e, "appearance");
|
|
331
338
|
if (t?.attributes?.theme)
|
|
332
339
|
return;
|
|
333
|
-
const r = t ??
|
|
340
|
+
const r = t ?? b(e, "appearance");
|
|
334
341
|
r.attributes = { ...r.attributes, theme: n };
|
|
335
342
|
}
|
|
336
|
-
function
|
|
337
|
-
const n =
|
|
343
|
+
function qe(e) {
|
|
344
|
+
const n = b(e, "resources");
|
|
338
345
|
n.attributes = {
|
|
339
346
|
...n.attributes,
|
|
340
347
|
host: "cdn",
|
|
341
348
|
math: "online"
|
|
342
349
|
};
|
|
343
350
|
}
|
|
344
|
-
function
|
|
351
|
+
function Ze(e, n = {}) {
|
|
345
352
|
const t = n.cssTheme?.trim(), r = n.revealTheme?.trim(), i = n.target === "slides";
|
|
346
353
|
if (!e && !t && !i)
|
|
347
|
-
return
|
|
348
|
-
const s = x(e ??
|
|
354
|
+
return B;
|
|
355
|
+
const s = x(e ?? B), o = v(s, "publication");
|
|
349
356
|
if (!o)
|
|
350
357
|
throw new Error(
|
|
351
358
|
"Invalid publication file: no root <publication> element found"
|
|
352
359
|
);
|
|
353
|
-
const a =
|
|
354
|
-
if (d.attributes = { ...d.attributes, portable: "yes" }, t &&
|
|
355
|
-
const l =
|
|
356
|
-
|
|
360
|
+
const a = b(o, "html"), d = b(a, "platform");
|
|
361
|
+
if (d.attributes = { ...d.attributes, portable: "yes" }, t && Ge(a, t), i) {
|
|
362
|
+
const l = b(o, "revealjs");
|
|
363
|
+
qe(l), r && Ye(l, r);
|
|
357
364
|
}
|
|
358
|
-
return
|
|
365
|
+
return S(s);
|
|
359
366
|
}
|
|
360
|
-
function
|
|
367
|
+
function J(e) {
|
|
361
368
|
if (!(e === void 0 || e === "" || e.startsWith("/")))
|
|
362
369
|
return e.endsWith("/") ? e : `${e}/`;
|
|
363
370
|
}
|
|
364
|
-
function
|
|
365
|
-
const n = x(e ??
|
|
371
|
+
function Qe(e) {
|
|
372
|
+
const n = x(e ?? B), t = v(n, "publication"), r = t && v(t, "source"), i = r && v(r, "directories"), s = J(
|
|
366
373
|
i?.attributes?.external ?? void 0
|
|
367
|
-
), o =
|
|
374
|
+
), o = J(
|
|
368
375
|
i?.attributes?.generated ?? void 0
|
|
369
376
|
);
|
|
370
377
|
return {
|
|
@@ -373,18 +380,18 @@ function Ye(e) {
|
|
|
373
380
|
managed: s !== void 0 && o !== void 0
|
|
374
381
|
};
|
|
375
382
|
}
|
|
376
|
-
function
|
|
383
|
+
function Ut(e) {
|
|
377
384
|
return e === "slides" || e === "scroll";
|
|
378
385
|
}
|
|
379
|
-
const
|
|
380
|
-
function
|
|
381
|
-
const n = typeof e == "number" && isFinite(e) ? e :
|
|
386
|
+
const ce = 960, le = 700, et = 1, tt = 0.04;
|
|
387
|
+
function nt(e) {
|
|
388
|
+
const n = typeof e == "number" && isFinite(e) ? e : et, t = Math.min(1, Math.max(0.25, n));
|
|
382
389
|
return {
|
|
383
|
-
width: Math.round(
|
|
384
|
-
height: Math.round(
|
|
390
|
+
width: Math.round(ce / t),
|
|
391
|
+
height: Math.round(le / t)
|
|
385
392
|
};
|
|
386
393
|
}
|
|
387
|
-
function
|
|
394
|
+
function rt(e) {
|
|
388
395
|
return {
|
|
389
396
|
view: "scroll",
|
|
390
397
|
scrollLayout: "compact",
|
|
@@ -394,11 +401,11 @@ function Qe(e) {
|
|
|
394
401
|
controls: !1,
|
|
395
402
|
controlsTutorial: !1,
|
|
396
403
|
hash: !1,
|
|
397
|
-
...
|
|
398
|
-
margin:
|
|
404
|
+
...nt(e.zoom),
|
|
405
|
+
margin: tt
|
|
399
406
|
};
|
|
400
407
|
}
|
|
401
|
-
function
|
|
408
|
+
function it() {
|
|
402
409
|
return {
|
|
403
410
|
// Explicitly null rather than absent: the same page may have been
|
|
404
411
|
// delivered in scroll view a moment ago, and an embedder that re-injects
|
|
@@ -410,11 +417,11 @@ function et() {
|
|
|
410
417
|
// size with a percentage width renders its text far larger, relative to
|
|
411
418
|
// the slide, than the same deck will on a projector. No zoom margin
|
|
412
419
|
// though — presenting means filling whatever it is shown in.
|
|
413
|
-
width:
|
|
414
|
-
height:
|
|
420
|
+
width: ce,
|
|
421
|
+
height: le
|
|
415
422
|
};
|
|
416
423
|
}
|
|
417
|
-
const
|
|
424
|
+
const st = [
|
|
418
425
|
"<style>",
|
|
419
426
|
".reveal-viewport.reveal-scroll .scroll-page section {",
|
|
420
427
|
" box-shadow: inset 0 0 0 calc(1px / var(--slide-scale, 1))",
|
|
@@ -422,14 +429,14 @@ const tt = [
|
|
|
422
429
|
"}",
|
|
423
430
|
"</style>"
|
|
424
431
|
].join(`
|
|
425
|
-
`),
|
|
432
|
+
`), ot = [
|
|
426
433
|
" var paused = document.querySelectorAll('.reveal .fragment');",
|
|
427
434
|
" for (var i = 0; i < paused.length; i++) {",
|
|
428
435
|
" paused[i].classList.remove('fragment');",
|
|
429
436
|
" }"
|
|
430
437
|
];
|
|
431
|
-
function
|
|
432
|
-
const t = e === "scroll" ?
|
|
438
|
+
function at(e, n = {}) {
|
|
439
|
+
const t = e === "scroll" ? rt(n) : it();
|
|
433
440
|
return [
|
|
434
441
|
"<script>",
|
|
435
442
|
"(function () {",
|
|
@@ -457,7 +464,7 @@ function rt(e, n = {}) {
|
|
|
457
464
|
// Inside the wrapper rather than at top level: this script sits in <head>,
|
|
458
465
|
// where the slides have not been parsed yet, but the deck calls initialize
|
|
459
466
|
// from the end of the document, by which time they have.
|
|
460
|
-
...e === "scroll" ?
|
|
467
|
+
...e === "scroll" ? ot : [],
|
|
461
468
|
" return initialize(merged);",
|
|
462
469
|
" };",
|
|
463
470
|
"})();",
|
|
@@ -465,23 +472,23 @@ function rt(e, n = {}) {
|
|
|
465
472
|
].join(`
|
|
466
473
|
`);
|
|
467
474
|
}
|
|
468
|
-
const
|
|
469
|
-
function
|
|
470
|
-
const r =
|
|
475
|
+
const ct = /<script\b[^>]*\bsrc=["'][^"']*\breveal\.js["'][^>]*>\s*<\/script>/i, lt = "<!--ptx-reveal-view-->", dt = "<!--/ptx-reveal-view-->", ut = /\n?<!--ptx-reveal-view-->[\s\S]*?<!--\/ptx-reveal-view-->/;
|
|
476
|
+
function ft(e, n, t = {}) {
|
|
477
|
+
const r = ut.exec(e), i = r ? e.slice(0, r.index) + e.slice(r.index + r[0].length) : e, s = ct.exec(i);
|
|
471
478
|
if (!s)
|
|
472
479
|
return i;
|
|
473
480
|
const o = s.index + s[0].length, a = `
|
|
481
|
+
${lt}
|
|
474
482
|
${st}
|
|
475
|
-
${
|
|
476
|
-
${
|
|
477
|
-
${ot}`;
|
|
483
|
+
${at(n, t)}
|
|
484
|
+
${dt}`;
|
|
478
485
|
return i.slice(0, o) + a + i.slice(o);
|
|
479
486
|
}
|
|
480
|
-
const
|
|
481
|
-
async function
|
|
482
|
-
return e.includes("include") ? (await
|
|
487
|
+
const de = "http://www.w3.org/2001/XInclude", K = 64;
|
|
488
|
+
async function pt(e, n, t) {
|
|
489
|
+
return e.includes("include") ? (await ue(e, n, t)).content : e;
|
|
483
490
|
}
|
|
484
|
-
async function
|
|
491
|
+
async function ue(e, n, t) {
|
|
485
492
|
const r = x(e), i = {
|
|
486
493
|
projectDir: p(t),
|
|
487
494
|
stack: [p(n)]
|
|
@@ -491,12 +498,12 @@ async function de(e, n, t) {
|
|
|
491
498
|
{ "": "" },
|
|
492
499
|
i
|
|
493
500
|
);
|
|
494
|
-
return { tree: r, content: s ?
|
|
501
|
+
return { tree: r, content: s ? S(r) : e };
|
|
495
502
|
}
|
|
496
|
-
function
|
|
503
|
+
function ht(e) {
|
|
497
504
|
return e.data?.ptxIncludedFile;
|
|
498
505
|
}
|
|
499
|
-
function
|
|
506
|
+
function mt(e, n) {
|
|
500
507
|
const t = e.data ?? (e.data = {});
|
|
501
508
|
t.ptxIncludedFile = n;
|
|
502
509
|
}
|
|
@@ -506,9 +513,9 @@ function _(e, n) {
|
|
|
506
513
|
(r === "xmlns" || r.startsWith("xmlns:")) && (t === e && (t = { ...e }), t[r === "xmlns" ? "" : r.slice(6)] = i ?? "");
|
|
507
514
|
return t;
|
|
508
515
|
}
|
|
509
|
-
function
|
|
516
|
+
function fe(e, n) {
|
|
510
517
|
const t = e.name.indexOf(":"), r = t === -1 ? "" : e.name.slice(0, t);
|
|
511
|
-
return (t === -1 ? e.name : e.name.slice(t + 1)) === "include" && n[r] ===
|
|
518
|
+
return (t === -1 ? e.name : e.name.slice(t + 1)) === "include" && n[r] === de;
|
|
512
519
|
}
|
|
513
520
|
async function y(e, n, t, r) {
|
|
514
521
|
let i = !1;
|
|
@@ -517,8 +524,8 @@ async function y(e, n, t, r) {
|
|
|
517
524
|
if (o.type !== "element")
|
|
518
525
|
continue;
|
|
519
526
|
const a = _(t, o);
|
|
520
|
-
if (
|
|
521
|
-
const d = await
|
|
527
|
+
if (fe(o, a)) {
|
|
528
|
+
const d = await pe(
|
|
522
529
|
o,
|
|
523
530
|
n,
|
|
524
531
|
a,
|
|
@@ -529,7 +536,7 @@ async function y(e, n, t, r) {
|
|
|
529
536
|
}
|
|
530
537
|
return i;
|
|
531
538
|
}
|
|
532
|
-
async function
|
|
539
|
+
async function pe(e, n, t, r) {
|
|
533
540
|
const i = r.stack[r.stack.length - 1];
|
|
534
541
|
if (e.attributes.xpointer)
|
|
535
542
|
throw new Error(
|
|
@@ -544,7 +551,7 @@ async function fe(e, n, t, r) {
|
|
|
544
551
|
} catch {
|
|
545
552
|
}
|
|
546
553
|
const a = p(n, o);
|
|
547
|
-
if (a !== r.projectDir && !a.startsWith(r.projectDir +
|
|
554
|
+
if (a !== r.projectDir && !a.startsWith(r.projectDir + A))
|
|
548
555
|
throw new Error(
|
|
549
556
|
`xi:include escapes the project directory: ${s} (in ${i})`
|
|
550
557
|
);
|
|
@@ -552,11 +559,11 @@ async function fe(e, n, t, r) {
|
|
|
552
559
|
throw new Error(
|
|
553
560
|
`Circular xi:include: ${[...r.stack, a].join(" -> ")}`
|
|
554
561
|
);
|
|
555
|
-
if (r.stack.length >=
|
|
556
|
-
throw new Error(`xi:include nesting exceeds ${
|
|
557
|
-
const d = await
|
|
562
|
+
if (r.stack.length >= K)
|
|
563
|
+
throw new Error(`xi:include nesting exceeds ${K} levels`);
|
|
564
|
+
const d = await C(a);
|
|
558
565
|
if (d === void 0) {
|
|
559
|
-
const f =
|
|
566
|
+
const f = vt(e, t);
|
|
560
567
|
if (f)
|
|
561
568
|
return await y(f, n, t, r), f.children;
|
|
562
569
|
throw new Error(`xi:include target not found: ${s} (in ${i})`);
|
|
@@ -581,13 +588,13 @@ async function fe(e, n, t, r) {
|
|
|
581
588
|
(f) => f.type === "element"
|
|
582
589
|
);
|
|
583
590
|
for (const f of u)
|
|
584
|
-
|
|
591
|
+
mt(f, a);
|
|
585
592
|
return u;
|
|
586
593
|
}
|
|
587
|
-
function
|
|
594
|
+
function G(e) {
|
|
588
595
|
return e.name === "docinfo";
|
|
589
596
|
}
|
|
590
|
-
async function
|
|
597
|
+
async function wt(e, n, t) {
|
|
591
598
|
try {
|
|
592
599
|
const i = x(e).children.find(
|
|
593
600
|
(l) => l.type === "element"
|
|
@@ -602,19 +609,19 @@ async function ft(e, n, t) {
|
|
|
602
609
|
if (l.type !== "element")
|
|
603
610
|
continue;
|
|
604
611
|
const u = _(d, l);
|
|
605
|
-
if (
|
|
606
|
-
return await y(l, o, u, a),
|
|
607
|
-
if (
|
|
608
|
-
const h = (await
|
|
612
|
+
if (G(l))
|
|
613
|
+
return await y(l, o, u, a), S(l);
|
|
614
|
+
if (fe(l, u)) {
|
|
615
|
+
const h = (await pe(
|
|
609
616
|
l,
|
|
610
617
|
o,
|
|
611
618
|
u,
|
|
612
619
|
a
|
|
613
620
|
)).find(
|
|
614
|
-
(m) => m.type === "element" &&
|
|
621
|
+
(m) => m.type === "element" && G(m)
|
|
615
622
|
);
|
|
616
623
|
if (h)
|
|
617
|
-
return
|
|
624
|
+
return S(h);
|
|
618
625
|
continue;
|
|
619
626
|
}
|
|
620
627
|
break;
|
|
@@ -624,33 +631,33 @@ async function ft(e, n, t) {
|
|
|
624
631
|
return;
|
|
625
632
|
}
|
|
626
633
|
}
|
|
627
|
-
function
|
|
634
|
+
function vt(e, n) {
|
|
628
635
|
for (const t of e.children) {
|
|
629
636
|
if (t.type !== "element")
|
|
630
637
|
continue;
|
|
631
638
|
const r = _(n, t), i = t.name.indexOf(":"), s = i === -1 ? "" : t.name.slice(0, i);
|
|
632
|
-
if ((i === -1 ? t.name : t.name.slice(i + 1)) === "fallback" && r[s] ===
|
|
639
|
+
if ((i === -1 ? t.name : t.name.slice(i + 1)) === "fallback" && r[s] === de)
|
|
633
640
|
return t;
|
|
634
641
|
}
|
|
635
642
|
}
|
|
636
|
-
function
|
|
643
|
+
function he(e) {
|
|
637
644
|
return typeof e == "object" && e !== null && e.type === "element";
|
|
638
645
|
}
|
|
639
|
-
function
|
|
646
|
+
function bt(e) {
|
|
640
647
|
return /^(pf|xhtml):/.test(e.name);
|
|
641
648
|
}
|
|
642
|
-
function
|
|
643
|
-
const r = [], i = e.children.find(
|
|
649
|
+
function gt(e, n, t) {
|
|
650
|
+
const r = [], i = e.children.find(he);
|
|
644
651
|
if (i) {
|
|
645
652
|
const s = t?.parentId ?? "root";
|
|
646
|
-
|
|
653
|
+
me(i, s, t?.position ?? 1, n, s, r);
|
|
647
654
|
}
|
|
648
655
|
return r;
|
|
649
656
|
}
|
|
650
|
-
function
|
|
651
|
-
const o =
|
|
657
|
+
function me(e, n, t, r, i, s) {
|
|
658
|
+
const o = ht(e) ?? r;
|
|
652
659
|
let a, d;
|
|
653
|
-
if (
|
|
660
|
+
if (bt(e))
|
|
654
661
|
d = "root";
|
|
655
662
|
else {
|
|
656
663
|
const u = e.attributes.label ?? e.attributes["xml:id"];
|
|
@@ -665,7 +672,7 @@ function he(e, n, t, r, i, s) {
|
|
|
665
672
|
}
|
|
666
673
|
let l = 0;
|
|
667
674
|
for (const u of e.children)
|
|
668
|
-
|
|
675
|
+
he(u) && (l += 1, me(
|
|
669
676
|
u,
|
|
670
677
|
d,
|
|
671
678
|
l,
|
|
@@ -674,28 +681,28 @@ function he(e, n, t, r, i, s) {
|
|
|
674
681
|
s
|
|
675
682
|
));
|
|
676
683
|
}
|
|
677
|
-
function
|
|
684
|
+
function Ht(e, n) {
|
|
678
685
|
let t;
|
|
679
686
|
for (const r of e)
|
|
680
687
|
r.line <= n && (t = r);
|
|
681
688
|
return t ?? e[0];
|
|
682
689
|
}
|
|
683
|
-
function
|
|
690
|
+
function yt(e) {
|
|
684
691
|
const n = e.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, " ");
|
|
685
692
|
return /<\s*slide(?:show)?[\s/>]/.test(n) ? "slides" : "html";
|
|
686
693
|
}
|
|
687
|
-
const
|
|
688
|
-
function
|
|
694
|
+
const we = "pretext-html:set-theme";
|
|
695
|
+
function Xt(e) {
|
|
689
696
|
return e === "dark" || e === "light" || e === "system";
|
|
690
697
|
}
|
|
691
|
-
function
|
|
692
|
-
return { type:
|
|
698
|
+
function Vt(e) {
|
|
699
|
+
return { type: we, theme: e };
|
|
693
700
|
}
|
|
694
|
-
function
|
|
701
|
+
function xt(e) {
|
|
695
702
|
return [
|
|
696
703
|
"<script>",
|
|
697
704
|
"(function () {",
|
|
698
|
-
" var CFG = " + JSON.stringify({ msg:
|
|
705
|
+
" var CFG = " + JSON.stringify({ msg: we, initial: e }) + ";",
|
|
699
706
|
// Where the last requested theme is remembered so it survives an in-place
|
|
700
707
|
// document rewrite (same Window) and outranks the baked initial value.
|
|
701
708
|
" var KEY = '__ptxPreviewTheme';",
|
|
@@ -765,56 +772,62 @@ function vt(e) {
|
|
|
765
772
|
].join(`
|
|
766
773
|
`);
|
|
767
774
|
}
|
|
768
|
-
function
|
|
769
|
-
const t =
|
|
775
|
+
function Et(e, n) {
|
|
776
|
+
const t = xt(n);
|
|
770
777
|
return /<head[^>]*>/i.test(e) ? e.replace(/<head([^>]*)>/i, `<head$1>
|
|
771
778
|
${t}`) : e;
|
|
772
779
|
}
|
|
773
|
-
function
|
|
774
|
-
return te(
|
|
780
|
+
function Tt() {
|
|
781
|
+
return te($(), "xsl");
|
|
775
782
|
}
|
|
776
|
-
function
|
|
783
|
+
function St() {
|
|
777
784
|
return "Suspending" in WebAssembly;
|
|
778
785
|
}
|
|
779
|
-
function
|
|
780
|
-
if (!
|
|
786
|
+
function $t() {
|
|
787
|
+
if (!St())
|
|
781
788
|
throw new Error(
|
|
782
789
|
"WebAssembly JSPI is not enabled. Run Node with --experimental-wasm-jspi (or use the pretext-html CLI, which re-launches itself with the flag)."
|
|
783
790
|
);
|
|
784
791
|
}
|
|
785
|
-
function
|
|
792
|
+
function D(e) {
|
|
786
793
|
return e.includes("'") ? e.includes('"') ? `concat(${e.split("'").map((t) => `'${t}'`).join(`, "'", `)})` : `"${e}"` : `'${e}'`;
|
|
787
794
|
}
|
|
788
|
-
function
|
|
795
|
+
function _t(e) {
|
|
789
796
|
return e.replace(
|
|
790
797
|
/from '\.\/(https:\/\/[^']+)'/g,
|
|
791
798
|
(n, t) => `from '${t}'`
|
|
792
799
|
);
|
|
793
800
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
801
|
+
const It = `https://cdn.jsdelivr.net/gh/PreTeXtBook/html-static@${re}/dist/`, Rt = {
|
|
802
|
+
"cli.version": re,
|
|
803
|
+
// Colon-delimited: pretext-runestone.xsl splits them with str:tokenize.
|
|
804
|
+
"rs-js": Be.join(":"),
|
|
805
|
+
"rs-css": Ce.join(":"),
|
|
806
|
+
"rs-version": je
|
|
807
|
+
};
|
|
808
|
+
function kt(e) {
|
|
796
809
|
return e.replace(
|
|
797
810
|
/(<link\b[^>]*\bhref=["'])_static\//gi,
|
|
798
|
-
`$1${
|
|
811
|
+
`$1${It}_static/`
|
|
799
812
|
);
|
|
800
813
|
}
|
|
801
|
-
function
|
|
814
|
+
function Dt(e) {
|
|
802
815
|
return e.slice(0, 65536).replace(/<\?[\s\S]*?\?>/g, " ").replace(/<!--[\s\S]*?-->/g, " ").replace(/<!DOCTYPE[^>]*>/gi, " ").match(/<\s*([A-Za-z][\w:-]*)/)?.[1];
|
|
803
816
|
}
|
|
804
|
-
async function
|
|
805
|
-
const n = await
|
|
817
|
+
async function Y(e) {
|
|
818
|
+
const n = await C(e);
|
|
806
819
|
if (n === void 0)
|
|
807
820
|
throw new Error(
|
|
808
821
|
`Could not read ${e}. (In the browser build only absolute URLs are readable — pass sourceContent instead of relying on sourcePath.)`
|
|
809
822
|
);
|
|
810
823
|
return n;
|
|
811
824
|
}
|
|
812
|
-
async function
|
|
813
|
-
const t = p(e), r = await
|
|
825
|
+
async function Mt(e, n) {
|
|
826
|
+
const t = p(e), r = await C(t);
|
|
814
827
|
if (r !== void 0)
|
|
815
|
-
return
|
|
828
|
+
return wt(r, t, n);
|
|
816
829
|
}
|
|
817
|
-
function
|
|
830
|
+
function Lt(e, n, t, r) {
|
|
818
831
|
const i = e.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").replace(/<!DOCTYPE[^>]*>/i, ""), s = t === "slides" ? "slideshow" : n === "chapter" || n === "part" ? "book" : "article";
|
|
819
832
|
return `<pretext>
|
|
820
833
|
${r?.trim() ? `${r.trim()}
|
|
@@ -825,63 +838,63 @@ ${i}
|
|
|
825
838
|
</pretext>
|
|
826
839
|
`;
|
|
827
840
|
}
|
|
828
|
-
let
|
|
829
|
-
function
|
|
841
|
+
let ve = !1;
|
|
842
|
+
function At(e) {
|
|
830
843
|
return e instanceof Error && /\bAborted\(/.test(e.message);
|
|
831
844
|
}
|
|
832
|
-
function
|
|
845
|
+
function jt(e) {
|
|
833
846
|
return e instanceof Error && /memory access|out of bounds/i.test(e.message);
|
|
834
847
|
}
|
|
835
|
-
function
|
|
836
|
-
if (
|
|
848
|
+
function Bt() {
|
|
849
|
+
if (ve)
|
|
837
850
|
throw new Error(
|
|
838
851
|
"The WebAssembly renderer aborted earlier in this process and cannot be reused. Restart the process (or reload the page) to render again."
|
|
839
852
|
);
|
|
840
853
|
}
|
|
841
854
|
function q(e) {
|
|
842
|
-
if (
|
|
843
|
-
throw
|
|
855
|
+
if (At(e))
|
|
856
|
+
throw ve = !0, new Error(
|
|
844
857
|
"The WebAssembly renderer aborted and cannot be reused. Restart the process (or reload the page) to render again.",
|
|
845
858
|
{ cause: e }
|
|
846
859
|
);
|
|
847
|
-
if (
|
|
860
|
+
if (jt(e))
|
|
848
861
|
throw new Error(
|
|
849
862
|
"The WebAssembly renderer hit a memory fault. Most often the document is too large for this build's stack — whole-book builds are a known limitation, so try a smaller document, or see the README about rebuilding libxslt-wasm with a larger stack. The same fault also results from running two renders concurrently against the shared libxslt state.",
|
|
850
863
|
{ cause: e }
|
|
851
864
|
);
|
|
852
865
|
}
|
|
853
|
-
let
|
|
854
|
-
async function
|
|
855
|
-
return
|
|
866
|
+
let M;
|
|
867
|
+
async function be() {
|
|
868
|
+
return M || (M = (async () => {
|
|
856
869
|
const [e, n] = await Promise.all([
|
|
857
870
|
import("@pretextbook/libxslt-wasm"),
|
|
858
871
|
import("@pretextbook/libxslt-wasm/exslt")
|
|
859
872
|
]);
|
|
860
873
|
return n.registerAll(), e;
|
|
861
|
-
})()),
|
|
874
|
+
})()), M;
|
|
862
875
|
}
|
|
863
|
-
const
|
|
876
|
+
const L = /* @__PURE__ */ new Map(), Ct = {
|
|
864
877
|
html: "preview-html.xsl",
|
|
865
878
|
slides: "preview-revealjs.xsl"
|
|
866
879
|
};
|
|
867
|
-
async function
|
|
868
|
-
const t =
|
|
869
|
-
let i =
|
|
880
|
+
async function Ot(e, n) {
|
|
881
|
+
const t = Ct[n], r = `${n}\0${e}`;
|
|
882
|
+
let i = L.get(r);
|
|
870
883
|
return i || (i = (async () => {
|
|
871
|
-
const { XmlDocument: s, XsltStylesheet: o } = await
|
|
884
|
+
const { XmlDocument: s, XsltStylesheet: o } = await be(), a = ae(e), d = await ne($(), `/${t}`);
|
|
872
885
|
if (d === void 0)
|
|
873
886
|
throw new Error(
|
|
874
|
-
`Could not read ${t} from ${
|
|
887
|
+
`Could not read ${t} from ${$()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
|
|
875
888
|
);
|
|
876
889
|
const l = new TextDecoder().decode(d), u = await s.fromString(l, {
|
|
877
890
|
url: `${a}/${t}`,
|
|
878
891
|
options: { noEnt: !0, dtdLoad: !0, huge: !0 }
|
|
879
892
|
});
|
|
880
893
|
return o.fromXmlDocument(u);
|
|
881
|
-
})(),
|
|
894
|
+
})(), L.set(r, i), i.catch(() => L.delete(r))), i;
|
|
882
895
|
}
|
|
883
896
|
let Z = Promise.resolve();
|
|
884
|
-
function
|
|
897
|
+
function zt(e) {
|
|
885
898
|
const n = Z.then(
|
|
886
899
|
() => Q(e),
|
|
887
900
|
() => Q(e)
|
|
@@ -890,55 +903,55 @@ function Nt(e) {
|
|
|
890
903
|
}), n;
|
|
891
904
|
}
|
|
892
905
|
async function Q(e) {
|
|
893
|
-
|
|
894
|
-
const { XmlDocument: n } = await
|
|
906
|
+
$t(), Bt();
|
|
907
|
+
const { XmlDocument: n } = await be(), t = p(e.sourcePath), r = p(
|
|
895
908
|
e.projectDir ?? g(t)
|
|
896
|
-
), i = e.sourceContent ?? await
|
|
909
|
+
), i = e.sourceContent ?? await Y(t), s = k(r, t);
|
|
897
910
|
if (s.startsWith(".."))
|
|
898
911
|
throw new Error(
|
|
899
912
|
`sourcePath (${t}) must live inside projectDir (${r})`
|
|
900
913
|
);
|
|
901
|
-
const o =
|
|
914
|
+
const o = k(
|
|
902
915
|
r,
|
|
903
916
|
p(e.mainSourcePath ?? t)
|
|
904
|
-
), a = o.startsWith("..") ? s : o, d =
|
|
917
|
+
), a = o.startsWith("..") ? s : o, d = ae(r);
|
|
905
918
|
try {
|
|
906
919
|
let l, u = `${d}/__pretext-preview-publication.xml`;
|
|
907
920
|
if (e.publicationPath) {
|
|
908
921
|
const c = p(e.publicationPath);
|
|
909
|
-
l = await
|
|
910
|
-
const
|
|
911
|
-
|
|
922
|
+
l = await Y(c);
|
|
923
|
+
const w = k(r, c);
|
|
924
|
+
w.startsWith("..") || (u = `${d}/${w.split(A).join("/")}`);
|
|
912
925
|
}
|
|
913
926
|
let f, h;
|
|
914
927
|
if (e.sourceMap) {
|
|
915
|
-
const c = await
|
|
928
|
+
const c = await ue(
|
|
916
929
|
i,
|
|
917
930
|
t,
|
|
918
931
|
r
|
|
919
932
|
);
|
|
920
933
|
f = c.tree, h = c.content;
|
|
921
934
|
} else
|
|
922
|
-
h = await
|
|
935
|
+
h = await pt(
|
|
923
936
|
i,
|
|
924
937
|
t,
|
|
925
938
|
r
|
|
926
939
|
);
|
|
927
|
-
const m = e.target ??
|
|
940
|
+
const m = e.target ?? yt(h), ge = await Ot(e.xslDir ?? Tt(), m), P = Ze(l, {
|
|
928
941
|
cssTheme: e.cssTheme,
|
|
929
942
|
revealTheme: e.revealTheme,
|
|
930
943
|
target: m
|
|
931
944
|
});
|
|
932
|
-
|
|
933
|
-
const E =
|
|
934
|
-
external: p(
|
|
935
|
-
generated: p(
|
|
936
|
-
} : void 0, T =
|
|
945
|
+
Je(u, P);
|
|
946
|
+
const E = Qe(P), N = g(p(r, a)), F = E.external !== void 0 && E.generated !== void 0 ? {
|
|
947
|
+
external: p(N, E.external),
|
|
948
|
+
generated: p(N, E.generated)
|
|
949
|
+
} : void 0, T = Dt(h);
|
|
937
950
|
let W = { parentId: "root", position: 1 };
|
|
938
951
|
if (T !== "pretext" && T !== "mathbook")
|
|
939
952
|
if (e.fragment) {
|
|
940
|
-
const c = e.docinfo ?? (e.docinfoSourcePath ? await
|
|
941
|
-
h =
|
|
953
|
+
const c = e.docinfo ?? (e.docinfoSourcePath ? await Mt(e.docinfoSourcePath, r) : void 0);
|
|
954
|
+
h = Lt(
|
|
942
955
|
h,
|
|
943
956
|
T,
|
|
944
957
|
m,
|
|
@@ -948,64 +961,66 @@ async function Q(e) {
|
|
|
948
961
|
throw new Error(
|
|
949
962
|
`The document root is <${T ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
|
|
950
963
|
);
|
|
951
|
-
const
|
|
952
|
-
url: `${d}/${a.split(
|
|
964
|
+
const U = f ? gt(f, t, W) : void 0, H = await n.fromString(h, {
|
|
965
|
+
url: `${d}/${a.split(A).join("/")}`,
|
|
953
966
|
options: { noEnt: !0, dtdLoad: !0, huge: !0 }
|
|
954
|
-
}),
|
|
955
|
-
publisher:
|
|
967
|
+
}), I = {
|
|
968
|
+
publisher: D(u)
|
|
956
969
|
};
|
|
957
|
-
for (const [c,
|
|
958
|
-
|
|
959
|
-
|
|
970
|
+
for (const [c, w] of Object.entries(Rt))
|
|
971
|
+
I[c] = D(w);
|
|
972
|
+
for (const [c, w] of Object.entries(e.stringParams ?? {}))
|
|
973
|
+
I[c] = D(w);
|
|
974
|
+
let R;
|
|
960
975
|
try {
|
|
961
|
-
|
|
976
|
+
R = await ge.apply(H, I);
|
|
962
977
|
} catch (c) {
|
|
963
978
|
throw q(c), new Error(
|
|
964
979
|
"PreTeXt XSLT transform failed; see the PTX:ERROR/PTX:FATAL messages on stderr for details.",
|
|
965
980
|
{ cause: c }
|
|
966
981
|
);
|
|
967
982
|
} finally {
|
|
968
|
-
|
|
983
|
+
H.delete();
|
|
969
984
|
}
|
|
970
985
|
try {
|
|
971
|
-
let c =
|
|
972
|
-
return (e.openKnowls ?? !0) && (c =
|
|
986
|
+
let c = _t(R.toHtmlString());
|
|
987
|
+
return (e.openKnowls ?? !0) && (c = We(c)), m === "slides" ? (c = kt(c), c = ft(c, e.revealView ?? "scroll", {
|
|
973
988
|
zoom: e.revealZoom
|
|
974
|
-
})) : e.theme && (c =
|
|
989
|
+
})) : e.theme && (c = Et(c, e.theme)), e.previewBanner && (c = ke(c, e.previewBanner)), {
|
|
975
990
|
html: c,
|
|
976
991
|
target: m,
|
|
977
|
-
...
|
|
978
|
-
...
|
|
992
|
+
...U ? { sourceMap: U } : {},
|
|
993
|
+
...F ? { assetDirs: F } : {}
|
|
979
994
|
};
|
|
980
995
|
} catch (c) {
|
|
981
996
|
throw q(c), c;
|
|
982
997
|
} finally {
|
|
983
|
-
|
|
998
|
+
R.delete();
|
|
984
999
|
}
|
|
985
1000
|
} finally {
|
|
986
|
-
|
|
1001
|
+
ze(d);
|
|
987
1002
|
}
|
|
988
1003
|
}
|
|
989
1004
|
export {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1005
|
+
xe as PREVIEW_BANNER_STORAGE_KEY,
|
|
1006
|
+
we as PREVIEW_THEME_MESSAGE,
|
|
1007
|
+
Tt as defaultXslDir,
|
|
1008
|
+
yt as detectRenderTarget,
|
|
1009
|
+
Ht as findSourceMapEntry,
|
|
1010
|
+
Ze as forcePortablePublication,
|
|
1011
|
+
ke as injectPreviewBanner,
|
|
1012
|
+
ft as injectRevealBridge,
|
|
1013
|
+
Et as injectThemeBridge,
|
|
1014
|
+
St as isJspiAvailable,
|
|
1015
|
+
Xt as isPreviewTheme,
|
|
1016
|
+
Ut as isRevealView,
|
|
1017
|
+
We as openBornHiddenKnowls,
|
|
1003
1018
|
$e as previewBannerScript,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1019
|
+
Vt as previewThemeMessage,
|
|
1020
|
+
zt as renderHtml,
|
|
1021
|
+
at as revealBridgeScript,
|
|
1022
|
+
Ft as setAssetsBase,
|
|
1023
|
+
Wt as setMountReader,
|
|
1024
|
+
xt as themeBridgeScript,
|
|
1025
|
+
D as xpathStringLiteral
|
|
1011
1026
|
};
|