@readium/guided-navigation 1.2.4 → 1.3.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/dist/index.js +1 -1
- package/fixtures/ROLES_COVERAGE.md +3 -3
- package/fixtures/abbreviation-period-mid-sentence/gnd.json +9 -0
- package/fixtures/abbreviation-period-mid-sentence/input.html +1 -0
- package/fixtures/abbreviation-period-mid-sentence/meta.json +11 -0
- package/fixtures/abbreviation-period-sentence-end/gnd.json +9 -0
- package/fixtures/abbreviation-period-sentence-end/input.html +1 -0
- package/fixtures/abbreviation-period-sentence-end/meta.json +11 -0
- package/fixtures/manifest.json +30 -0
- package/fixtures/table-cell-link/gnd.json +48 -0
- package/fixtures/table-cell-link/input.html +1 -0
- package/fixtures/table-cell-link/meta.json +14 -0
- package/package.json +1 -1
- package/src/emptyPairs.ts +2 -1
- package/src/index.ts +1 -0
- package/types/src/emptyPairs.d.ts +2 -0
- package/types/src/index.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeGnd as r}from"./makeGnd.js";import{parseMarkup as m}from"./converter.js";import{combineDomRangeTextrefs as
|
|
1
|
+
import{makeGnd as r}from"./makeGnd.js";import{parseMarkup as m}from"./converter.js";import{combineDomRangeTextrefs as n,decodeCssSelectorFragment as a,decodeDomRangeFragment as s,decodeTextref as c,encodeCssSelectorFragment as p,encodeDomRangeFragment as f}from"./textrefFragment.js";import{isAriaSubstituted as x,substitutedOwnSelector as D}from"./object.js";import{DROPPED as u,removeDropped as F}from"./emptyPairs.js";export{u as DROPPED,n as combineDomRangeTextrefs,a as decodeCssSelectorFragment,s as decodeDomRangeFragment,c as decodeTextref,p as encodeCssSelectorFragment,f as encodeDomRangeFragment,x as isAriaSubstituted,r as makeGnd,m as parseMarkup,F as removeDropped,D as substitutedOwnSelector};
|
|
@@ -7,7 +7,7 @@ renaming, or removing a fixture.
|
|
|
7
7
|
|
|
8
8
|
| Role | Fixtures |
|
|
9
9
|
| --- | --- |
|
|
10
|
-
| `abbreviation` | `abbreviation-acronym-html-native`, `abbreviation-before-formatting`, `abbreviation-before-image`, `abbreviation-html-native`, `abbreviation-language`, `abbreviation-line-break`, `abbreviation-nested`, `abbreviation-nested-emphasis`, `abbreviation-nested-term`, `abbreviation-nested-term-punctuation`, `abbreviation-no-title`, `abbreviation-spanning-terms`, `abbreviation-with-image`, `abbreviation-with-svg-and-math` |
|
|
10
|
+
| `abbreviation` | `abbreviation-acronym-html-native`, `abbreviation-before-formatting`, `abbreviation-before-image`, `abbreviation-html-native`, `abbreviation-language`, `abbreviation-line-break`, `abbreviation-nested`, `abbreviation-nested-emphasis`, `abbreviation-nested-term`, `abbreviation-nested-term-punctuation`, `abbreviation-no-title`, `abbreviation-period-mid-sentence`, `abbreviation-period-sentence-end`, `abbreviation-spanning-terms`, `abbreviation-with-image`, `abbreviation-with-svg-and-math` |
|
|
11
11
|
| `abstract` | `abstract-epub-type`, `abstract-role-aria` |
|
|
12
12
|
| `accessible-name` | `accessible-name-labelledby-aria-hidden`, `accessible-name-labelledby-hidden-attribute` |
|
|
13
13
|
| `acknowledgments` | `acknowledgments-epub-type`, `acknowledgments-role-aria` |
|
|
@@ -49,7 +49,7 @@ renaming, or removing a fixture.
|
|
|
49
49
|
| `introduction` | `introduction-epub-type`, `introduction-role-aria` |
|
|
50
50
|
| `landmarks` | `landmarks-epub-type` |
|
|
51
51
|
| `language` | `language-block`, `language-block-empty-lang`, `language-document`, `language-empty-lang-stops-inheritance`, `language-inline-case-insensitive`, `language-inline-case-insensitive-ssml`, `language-inline-empty-lang`, `language-inline-empty-lang-formatted`, `language-inline-empty-lang-only`, `language-inline-empty-lang-undeclared`, `language-inline-lang-attribute`, `language-inline-nested`, `language-inline-repeated`, `language-inline-two-languages`, `language-xml-lang-empty-html-inherits`, `language-xml-lang-empty-html-lang-applies`, `language-xml-lang-empty-xhtml`, `language-xml-lang-over-lang` |
|
|
52
|
-
| `link` | `language-link-switches`, `link-containing-image`, `link-containing-pagebreak`, `link-content-conversion`, `link-content-identity`, `link-content-words` |
|
|
52
|
+
| `link` | `language-link-switches`, `link-containing-image`, `link-containing-pagebreak`, `link-content-conversion`, `link-content-identity`, `link-content-words`, `table-cell-link` |
|
|
53
53
|
| `list` | `list-aria-posinset-setsize`, `list-epub-type`, `list-html-native`, `list-item-posinset-override`, `list-item-value-override`, `list-ordered-html-native`, `list-ordered-reversed`, `list-ordered-start`, `list-role-aria` |
|
|
54
54
|
| `loa` | `loa-epub-type` |
|
|
55
55
|
| `loi` | `loi-epub-type` |
|
|
@@ -81,4 +81,4 @@ renaming, or removing a fixture.
|
|
|
81
81
|
| `toc` | `toc-epub-type`, `toc-role-aria` |
|
|
82
82
|
| `video` | `video-html-native`, `video-no-description` |
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
259 fixtures across 73 roles.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>The <abbr title="World Health Organization">W.H.O.</abbr> said.</p>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "abbreviation-period-mid-sentence",
|
|
3
|
+
"description": "An abbreviation's final period doesn't end the sentence",
|
|
4
|
+
"role": "abbreviation",
|
|
5
|
+
"rolesCovered": [
|
|
6
|
+
"paragraph",
|
|
7
|
+
"abbreviation"
|
|
8
|
+
],
|
|
9
|
+
"sourceRef": "https://github.com/readium/guided-navigation/tree/main/examples/read-aloud",
|
|
10
|
+
"inputKind": "fragment"
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>She joined the <abbr title="World Health Organization">W.H.O.</abbr> Then she left.</p>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "abbreviation-period-sentence-end",
|
|
3
|
+
"description": "An abbreviation's own final period also ends the sentence; its expansion is the sub's alias",
|
|
4
|
+
"role": "abbreviation",
|
|
5
|
+
"rolesCovered": [
|
|
6
|
+
"paragraph",
|
|
7
|
+
"abbreviation"
|
|
8
|
+
],
|
|
9
|
+
"sourceRef": "https://github.com/readium/guided-navigation/tree/main/examples/read-aloud",
|
|
10
|
+
"inputKind": "fragment"
|
|
11
|
+
}
|
package/fixtures/manifest.json
CHANGED
|
@@ -109,6 +109,26 @@
|
|
|
109
109
|
"gnd": "gnd.json"
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
"id": "abbreviation-period-mid-sentence",
|
|
114
|
+
"dir": "abbreviation-period-mid-sentence",
|
|
115
|
+
"role": "abbreviation",
|
|
116
|
+
"description": "An abbreviation's final period doesn't end the sentence",
|
|
117
|
+
"files": {
|
|
118
|
+
"input": "input.html",
|
|
119
|
+
"gnd": "gnd.json"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "abbreviation-period-sentence-end",
|
|
124
|
+
"dir": "abbreviation-period-sentence-end",
|
|
125
|
+
"role": "abbreviation",
|
|
126
|
+
"description": "An abbreviation's own final period also ends the sentence; its expansion is the sub's alias",
|
|
127
|
+
"files": {
|
|
128
|
+
"input": "input.html",
|
|
129
|
+
"gnd": "gnd.json"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
112
132
|
{
|
|
113
133
|
"id": "abbreviation-spanning-terms",
|
|
114
134
|
"dir": "abbreviation-spanning-terms",
|
|
@@ -2269,6 +2289,16 @@
|
|
|
2269
2289
|
"gnd": "gnd.json"
|
|
2270
2290
|
}
|
|
2271
2291
|
},
|
|
2292
|
+
{
|
|
2293
|
+
"id": "table-cell-link",
|
|
2294
|
+
"dir": "table-cell-link",
|
|
2295
|
+
"role": "link",
|
|
2296
|
+
"description": "A link in a table cell; the cell's plain keeps the link's words",
|
|
2297
|
+
"files": {
|
|
2298
|
+
"input": "input.html",
|
|
2299
|
+
"gnd": "gnd.json"
|
|
2300
|
+
}
|
|
2301
|
+
},
|
|
2272
2302
|
{
|
|
2273
2303
|
"id": "table-cell-noteref",
|
|
2274
2304
|
"dir": "table-cell-noteref",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"role": [
|
|
3
|
+
"table"
|
|
4
|
+
],
|
|
5
|
+
"children": [
|
|
6
|
+
{
|
|
7
|
+
"role": [
|
|
8
|
+
"row"
|
|
9
|
+
],
|
|
10
|
+
"children": [
|
|
11
|
+
{
|
|
12
|
+
"role": [
|
|
13
|
+
"columnheader"
|
|
14
|
+
],
|
|
15
|
+
"text": {
|
|
16
|
+
"plain": "Keeper"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"role": [
|
|
23
|
+
"row"
|
|
24
|
+
],
|
|
25
|
+
"children": [
|
|
26
|
+
{
|
|
27
|
+
"role": [
|
|
28
|
+
"cell"
|
|
29
|
+
],
|
|
30
|
+
"text": {
|
|
31
|
+
"plain": "Henry Winstanley himself",
|
|
32
|
+
"ssml": "Henry <readium:link id=\"link1\" /> himself",
|
|
33
|
+
"language": "en"
|
|
34
|
+
},
|
|
35
|
+
"children": [
|
|
36
|
+
{
|
|
37
|
+
"id": "link1",
|
|
38
|
+
"text": {
|
|
39
|
+
"plain": "Winstanley"
|
|
40
|
+
},
|
|
41
|
+
"textref": "c.html"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<table><tr><th>Keeper</th></tr><tr><td>Henry <a href="c.html">Winstanley</a> himself</td></tr></table>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "table-cell-link",
|
|
3
|
+
"description": "A link in a table cell; the cell's plain keeps the link's words",
|
|
4
|
+
"role": "link",
|
|
5
|
+
"rolesCovered": [
|
|
6
|
+
"table",
|
|
7
|
+
"row",
|
|
8
|
+
"columnheader",
|
|
9
|
+
"cell",
|
|
10
|
+
"link"
|
|
11
|
+
],
|
|
12
|
+
"sourceRef": "https://github.com/readium/guided-navigation/tree/main/examples/read-aloud",
|
|
13
|
+
"inputKind": "fragment"
|
|
14
|
+
}
|
package/package.json
CHANGED
package/src/emptyPairs.ts
CHANGED
|
@@ -48,7 +48,8 @@ export function bindsToPrevious(text: string, lang: string | undefined): boolean
|
|
|
48
48
|
return !(marksFor(lang).opening.has(text[0]) && text.length > 1 && !/[\s\p{P}]/u.test(text[1]));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
/** Takes each `DROPPED` out of plain text in `lang`, with any bracket or quote pair left enclosing only fillers (spaces, commas, other `DROPPED`).
|
|
52
|
+
* Spaces around what's removed collapse to one, dropped at either end of the text and before binding punctuation; no space is added where there was none. */
|
|
52
53
|
export function removeDropped(plain: string, lang: string | undefined): string {
|
|
53
54
|
const { pairs, opening, closing } = marksFor(lang);
|
|
54
55
|
for (let i = plain.indexOf(DROPPED); i !== -1; i = plain.indexOf(DROPPED, i + 1)) {
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const DROPPED = "\0";
|
|
2
2
|
export declare function bindsToPrevious(text: string, lang: string | undefined): boolean;
|
|
3
|
+
/** Takes each `DROPPED` out of plain text in `lang`, with any bracket or quote pair left enclosing only fillers (spaces, commas, other `DROPPED`).
|
|
4
|
+
* Spaces around what's removed collapse to one, dropped at either end of the text and before binding punctuation; no space is added where there was none. */
|
|
3
5
|
export declare function removeDropped(plain: string, lang: string | undefined): string;
|
package/types/src/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export type { GndGenerationOptions, TextrefOptions } from "./options.ts";
|
|
|
6
6
|
export { encodeCssSelectorFragment, decodeCssSelectorFragment, encodeDomRangeFragment, decodeDomRangeFragment, decodeTextref, combineDomRangeTextrefs, } from "./textrefFragment.ts";
|
|
7
7
|
export type { DomRangeJSON, DecodedTextref } from "./textrefFragment.ts";
|
|
8
8
|
export { isAriaSubstituted, substitutedOwnSelector } from "./object.ts";
|
|
9
|
+
export { DROPPED, removeDropped } from "./emptyPairs.ts";
|