Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.

**Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution.

## [Unreleased]

### Added

- The `manifest` command now infers the languages of a publication's text when `--inspect-html` is combined with `--infer-a11y=split`. The publication's (X)HTML documents are scanned through their guided navigation representation, and the languages declared in them (`lang` or `xml:lang`) are listed under `language` in the inferred accessibility object, as BCP-47 tags ordered by the number of strings found in each language, most used first. Like `metadata.language`, a single language is written as a string instead of a one-item array
- A string is a block of text, or a run of text in another language inside of one (e.g. `<i lang="fr">`). Text with no declared language is not counted, so nothing is inferred for publications that don't declare any
- Tags are normalized (`en_us` becomes `en-US`) and keep their region and script, so `en` and `en-US` are listed separately. Tags that are not valid are ignored
- This inference is never merged into the publication's own metadata: nothing is inferred with `--infer-a11y=merged`
- The `manifest` command now infers the `textual` and `visual` access modes from the content of a publication's (X)HTML documents when `--inspect-html` is combined with `--infer-a11y`. `textual` is inferred when a document contains text, and `visual` when one contains an image, an inline SVG or a video which is neither decorative (`role="presentation"` or `role="none"`) nor a cover
- Only the documents of the reading order are read, without the navigation document. Image descriptions such as `alt` are not text, so a publication made of images is not `textual`. An image with an empty `alt` is not considered decorative
- These access modes are inferred even when the publication declares its own `accessMode`: the missing ones are added to it with `--infer-a11y=merged`, or listed in the inferred accessibility object with `--infer-a11y=split`

### Changed

- The go-toolkit has been updated to v0.17.1. For the detailed list, refer to the [go-toolkit's changelog](https://github.com/readium/go-toolkit/blob/develop/CHANGELOG.md); the highlights as they apply to the CLI:
- Publications are handled more strictly as untrusted input. Crafted ZIP archives can no longer make the CLI allocate gigabytes of memory, and package documents (manifests, OPF, navigation documents, media overlays…) larger than 32 MiB are an error instead of being read whole
- Exploded publications no longer serve files outside of their directory through symbolic links, nor named pipes or devices. S3 and GCS publications list every object of their prefix, rather than the first 1000
- The access mode inference changes below
- The `visual` access mode is no longer inferred from the images and videos which are only listed in a publication's `resources`, which made nearly every EPUB with a cover `visual`. Without `--inspect-html`, it is now only inferred when the reading order itself contains an image or a video. For most EPUBs, this means that `--infer-a11y` alone no longer infers `visual`: combine it with `--inspect-html` to infer it from the images the documents actually use
- With `--inspect-html`, the `references` of an image now list the places where it's used as a decorative image (`"role": ["presentation"]`) or with an empty `alt`, which were left out before, as well as the SVGs embedding it with an `<image>` element
- With `--inspect-html`, each (X)HTML document is now converted to its guided navigation representation only once, instead of once for every inspection that reads it

## [0.11.0] - 2026-11-15

### Changed
Expand Down
25 changes: 20 additions & 5 deletions docs/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ It takes one of the following arguments:
| Key | Value | Rules |
| --- | ----- | ----- |
| `accessMode` | `auditory` | If the publication contains a reference to an audio or video resource (inspect `resources` and `readingOrder` in RWPM). |
| `accessMode` | `visual` | If the publications contains a reference to an image or a video resource (inspect `resources` and `readingOrder` in RWPM). |
| `accessMode` | `textual` | If `textual` is inferred for `accessModeSufficient` (see below).<br>:warning: With the `--inspect-html` flag: also if any (X)HTML document of the reading order contains text. See [access modes inferred from documents](#access-modes-inferred-from-documents). |
| `accessMode` | `visual` | If the reading order contains an image or a video resource (inspect `readingOrder` in RWPM). The ones which are only listed in `resources` are not enough.<br>:warning: With the `--inspect-html` flag: also if any (X)HTML document of the reading order contains an image or a video which is neither decorative nor a cover. See [access modes inferred from documents](#access-modes-inferred-from-documents). |
| `accessModeSufficient` | `textual` | If the publication is partially or fully accessible (WCAG A or above).<br>Or if the publication does not contain any image, audio or video resource (inspect "resources" and "readingOrder" in RWPM)<br>Or if the only image available can be identified as a cover. `--infer-a11y-ignore-image-` flags extend this inference by counting ignored images as non available.|
| `feature` | `displayTransformability` | :warning: This rule is only used with reflowable EPUB files that conform to WCAG AA or above. |
| `feature` | `pageNavigation` | If the publications contains a page list (check for the presence of a `pageList` collection in RWPM). |
Expand All @@ -49,6 +50,23 @@ It takes one of the following arguments:
| `feature` | `pageBreakMarkers` | :warning: This rule requires the `--inspect-html` flag. If any of the publication's (X)HTML documents contains a page break marker (`epub:type="pagebreak"` or `role="doc-pagebreak"`). |
| `language` | BCP-47 language tags | :warning: This rule requires the `--inspect-html` flag, and is only used with `--infer-a11y=split`: inferred languages are never merged with the authored metadata. The languages declared in the publication's (X)HTML documents (`lang` or `xml:lang`), ordered by the number of strings found in each language, most used first. |

Unless stated otherwise, an `accessMode` is only inferred from the manifest when the publication doesn't declare any.

#### Access modes inferred from documents

A manifest lists the images of a publication, but doesn't tell how they're used, and says nothing of the text. Combined with `--infer-a11y`, the `--inspect-html` flag reads the (X)HTML documents to find out:

```sh
readium manifest --inspect-html --infer-a11y=split publication.epub
```

- `textual` is inferred when a document contains text. The description of an image (such as its `alt`) is not text, and neither is the page number of a page break marker: a publication made of images is not `textual`, however well described they are.
- `visual` is inferred when a document contains an image, an inline SVG or a video which is:
- not decorative, which takes a `role="presentation"` or a `role="none"`. An empty `alt` is not enough: these are common on images that do convey information.
- not a cover: the image is not the cover of the publication (`rel` is `cover` in RWPM), and neither it nor any of the elements it's in is marked as a cover (`epub:type="cover"` or `role="doc-cover"`).
- Only the documents of the reading order are read, except for the navigation document if it's part of it. Documents with `linear="no"` in the spine of an EPUB are not read.
- Unlike the access modes inferred from the manifest, these are inferred even when the publication declares its own. With `--infer-a11y=merged`, the missing ones are added to them: a publication declaring `textual` which has an illustration ends up with `["textual", "visual"]`. With `--infer-a11y=split`, only the ones the publication doesn't declare are listed in the inferred accessibility object.

#### Inferred languages

The inferred `language` is not part of the accessibility metadata that a publication can declare, which is why it's only available in the inferred accessibility object:
Expand All @@ -59,7 +77,7 @@ readium manifest --inspect-html --infer-a11y=split publication.epub

```json
"https://readium.org/webpub-manifest#inferredAccessibility": {
"accessMode": ["visual"],
"accessMode": ["textual", "visual"],
"feature": ["tableOfContents"],
"language": ["fr", "en-US"]
}
Expand Down Expand Up @@ -167,9 +185,6 @@ readium manifest --infer-a11y=split moby-dick.epub | jq .metadata
"http://www.idpf.org/2007/opf#version": "3.0",
"https://github.com/readium/go-toolkit/releases": "v0.10.1",
"https://readium.org/webpub-manifest#inferredAccessibility": {
"accessMode": [
"visual"
],
"feature": [
"tableOfContents"
]
Expand Down
43 changes: 22 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/readium/cli
go 1.26.0

require (
cloud.google.com/go/storage v1.71.0
cloud.google.com/go/storage v1.71.1
github.com/CAFxX/httpcompression v0.0.9
github.com/MicahParks/jwkset v0.12.0
github.com/MicahParks/keyfunc/v3 v3.9.2
github.com/airmrcr/go-problem v0.5.0
github.com/andybalholm/brotli v1.3.0
github.com/aws/aws-sdk-go-v2 v1.48.0
github.com/aws/aws-sdk-go-v2 v1.48.1
github.com/aws/aws-sdk-go-v2/config v1.33.21
github.com/aws/aws-sdk-go-v2/credentials v1.21.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.116.0
Expand All @@ -20,26 +20,26 @@ require (
github.com/gotd/contrib v0.26.0
github.com/maypok86/otter/v2 v2.4.0
github.com/pkg/errors v0.9.1
github.com/readium/go-toolkit v0.16.2
github.com/readium/go-toolkit v0.17.1
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.12.1
github.com/vmihailenco/go-tinylfu v0.2.2
github.com/zeebo/xxh3 v1.1.0
golang.org/x/text v0.44.0
google.golang.org/api v0.312.0
google.golang.org/api v0.317.0
lukechampine.com/blake3 v1.5.3
)

require (
cel.dev/expr v0.25.3 // indirect
cel.dev/expr v0.26.0 // indirect
cloud.google.com/go v0.123.0 // indirect
cloud.google.com/go/auth v0.24.4 // indirect
cloud.google.com/go/auth v0.24.5 // indirect
cloud.google.com/go/auth/oauth2adapt v0.3.1 // indirect
cloud.google.com/go/compute/metadata v0.10.0 // indirect
cloud.google.com/go/iam v1.15.1 // indirect
cloud.google.com/go/monitoring v1.30.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.62.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.62.0 // indirect
cloud.google.com/go/monitoring v1.32.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.63.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.63.0 // indirect
github.com/abema/go-mp4 v1.7.4 // indirect
github.com/agext/regexp v1.3.0 // indirect
github.com/airmrcr/go-optional v0.2.0 // indirect
Expand All @@ -59,7 +59,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.39.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.44.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.53.0 // indirect
github.com/aws/smithy-go v1.28.9 // indirect
github.com/aws/smithy-go v1.28.10 // indirect
github.com/azr/gift v1.1.2 // indirect
github.com/azr/phash v0.2.0 // indirect
github.com/bbrks/go-blurhash v1.2.0 // indirect
Expand All @@ -68,10 +68,10 @@ require (
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be // indirect
github.com/envoyproxy/go-control-plane/envoy v1.40.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.6 // indirect
github.com/go-jose/go-jose/v4 v4.1.9 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
Expand All @@ -82,17 +82,17 @@ require (
github.com/hhrutter/tiff v1.0.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kettek/apng v0.0.0-20220823221153-ff692776a607 // indirect
github.com/klauspost/compress v1.19.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
github.com/klauspost/compress v1.20.5 // indirect
github.com/klauspost/cpuid/v2 v2.4.2 // indirect
github.com/pdfcpu/pdfcpu v0.16.4 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/readium/zran v0.0.0-20260525212206-dcf56adb2c0e // indirect
github.com/relvacode/iso8601 v1.8.3 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect
github.com/spiffe/go-spiffe/v2 v2.9.0 // indirect
github.com/trimmer-io/go-xmp v1.0.0 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.2 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 // indirect
Expand All @@ -104,18 +104,19 @@ require (
go.opentelemetry.io/otel/trace v1.47.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/crypto v0.58.0 // indirect
golang.org/x/crypto v0.59.0 // indirect
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/image v0.48.0 // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/net v0.63.0 // indirect
golang.org/x/oauth2 v0.38.0 // indirect
golang.org/x/sync v0.25.0 // indirect
golang.org/x/sys v0.50.0 // indirect
golang.org/x/time v0.16.0 // indirect
google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c // indirect
google.golang.org/genproto v0.0.0-20261123191846-1e707ab9fbc2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2 // indirect
google.golang.org/grpc v1.85.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading