@storyteller-platform/align 0.1.50 → 0.1.51
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/dist/common/shell.cjs +1 -1
- package/dist/common/shell.js +1 -1
- package/dist/markup/parseDom.cjs +15 -2
- package/dist/markup/parseDom.js +15 -2
- package/package.json +3 -3
package/dist/common/shell.cjs
CHANGED
|
@@ -22,7 +22,7 @@ __export(shell_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(shell_exports);
|
|
24
24
|
function quotePath(path) {
|
|
25
|
-
return `"${path.replaceAll(/"/g,
|
|
25
|
+
return `"${path.replaceAll(/(["\\$`])/g, "\\$1")}"`;
|
|
26
26
|
}
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
package/dist/common/shell.js
CHANGED
package/dist/markup/parseDom.cjs
CHANGED
|
@@ -31,6 +31,7 @@ function parseDom(xml) {
|
|
|
31
31
|
}
|
|
32
32
|
const FOOTNOTE_ROLES = ["footnote", "rearnote", "endnote", "note"];
|
|
33
33
|
class Parser {
|
|
34
|
+
footnoteIds = /* @__PURE__ */ new Set();
|
|
34
35
|
parseDom(xml) {
|
|
35
36
|
const children = this.parseDomChildren(xml);
|
|
36
37
|
return new import_model.Root(children);
|
|
@@ -57,12 +58,24 @@ class Parser {
|
|
|
57
58
|
);
|
|
58
59
|
if (tagName === "a" && attrs["epub:type"] === "noteref") {
|
|
59
60
|
const node = new import_model.NoterefNode(tagName, attrs, blockChildren, marks);
|
|
61
|
+
const href = node.attrs["href"];
|
|
62
|
+
const fragment = href?.split("#")[1];
|
|
63
|
+
if (fragment) {
|
|
64
|
+
this.footnoteIds.add(fragment);
|
|
65
|
+
}
|
|
60
66
|
return node;
|
|
61
67
|
}
|
|
62
|
-
if (FOOTNOTE_ROLES.includes(attrs["epub:type"] ?? "")
|
|
68
|
+
if (attrs["id"] && (FOOTNOTE_ROLES.includes(attrs["epub:type"] ?? "") || // Some footnotes aren't properly marked up with the
|
|
69
|
+
// correct role
|
|
70
|
+
this.footnoteIds.has(attrs["id"]))) {
|
|
63
71
|
const footnoteNode = new import_model.FootnoteNode(
|
|
64
72
|
tagName,
|
|
65
|
-
|
|
73
|
+
{
|
|
74
|
+
// Fall back to 'footnote' if role
|
|
75
|
+
// is missing
|
|
76
|
+
"epub:type": "footnote",
|
|
77
|
+
...attrs
|
|
78
|
+
},
|
|
66
79
|
blockChildren,
|
|
67
80
|
marks
|
|
68
81
|
);
|
package/dist/markup/parseDom.js
CHANGED
|
@@ -16,6 +16,7 @@ function parseDom(xml) {
|
|
|
16
16
|
}
|
|
17
17
|
const FOOTNOTE_ROLES = ["footnote", "rearnote", "endnote", "note"];
|
|
18
18
|
class Parser {
|
|
19
|
+
footnoteIds = /* @__PURE__ */ new Set();
|
|
19
20
|
parseDom(xml) {
|
|
20
21
|
const children = this.parseDomChildren(xml);
|
|
21
22
|
return new Root(children);
|
|
@@ -42,12 +43,24 @@ class Parser {
|
|
|
42
43
|
);
|
|
43
44
|
if (tagName === "a" && attrs["epub:type"] === "noteref") {
|
|
44
45
|
const node = new NoterefNode(tagName, attrs, blockChildren, marks);
|
|
46
|
+
const href = node.attrs["href"];
|
|
47
|
+
const fragment = href?.split("#")[1];
|
|
48
|
+
if (fragment) {
|
|
49
|
+
this.footnoteIds.add(fragment);
|
|
50
|
+
}
|
|
45
51
|
return node;
|
|
46
52
|
}
|
|
47
|
-
if (FOOTNOTE_ROLES.includes(attrs["epub:type"] ?? "")
|
|
53
|
+
if (attrs["id"] && (FOOTNOTE_ROLES.includes(attrs["epub:type"] ?? "") || // Some footnotes aren't properly marked up with the
|
|
54
|
+
// correct role
|
|
55
|
+
this.footnoteIds.has(attrs["id"]))) {
|
|
48
56
|
const footnoteNode = new FootnoteNode(
|
|
49
57
|
tagName,
|
|
50
|
-
|
|
58
|
+
{
|
|
59
|
+
// Fall back to 'footnote' if role
|
|
60
|
+
// is missing
|
|
61
|
+
"epub:type": "footnote",
|
|
62
|
+
...attrs
|
|
63
|
+
},
|
|
51
64
|
blockChildren,
|
|
52
65
|
marks
|
|
53
66
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyteller-platform/align",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"description": "A library and CLI for automatically aligning audiobooks and EPUBs to produce Media Overlays",
|
|
5
5
|
"author": "Shane Friedman",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@optique/core": "^0.10.7",
|
|
71
71
|
"@optique/run": "^0.10.7",
|
|
72
72
|
"@readium/shared": "^2.2.0",
|
|
73
|
-
"@storyteller-platform/audiobook": "^0.4.
|
|
74
|
-
"@storyteller-platform/epub": "^0.6.
|
|
73
|
+
"@storyteller-platform/audiobook": "^0.4.2",
|
|
74
|
+
"@storyteller-platform/epub": "^0.6.3",
|
|
75
75
|
"@storyteller-platform/ghost-story": "^0.1.11",
|
|
76
76
|
"@storyteller-platform/transliteration": "^3.1.2",
|
|
77
77
|
"chalk": "^5.4.1",
|