Repository navigation
Add image references to the manifest #88
Copy link
Copy link
Closed
Labels
manifestRelated to the manifest commandRelated to the manifest command
Description
Activity
- addedmanifestRelated to the manifest commandRelated to the manifest command
on Dec 22, 2025 We'll use a new flag for inspecting HTML:
--inspect-htmlThis means that the first example listed in this issue requires both
--inspect-imagesand--inspect-html.@HadrienGardeur Output from
go run cmd/main.go manifest --indent ' ' --inspect-images --inspect-html ./publications/moby-dick.epub{ "@context": "https://readium.org/webpub-manifest/context.jsonld", "landmarks": [ { "href": "OPS/toc.xhtml#toc", "title": "Table of Contents" }, { "href": "OPS/chapter_001.xhtml", "title": "Begin Reading" }, { "href": "OPS/copyright.xhtml", "title": "Copyright Page" } ], "links": [ { "href": "http://creativecommons.org/licenses/by-sa/3.0/", "rel": "http://creativecommons.org/ns#license" } ], "metadata": { "author": { "name": "Herman Melville", "sortAs": "MELVILLE, HERMAN" }, "conformsTo": "https://readium.org/webpub-manifest/profiles/epub", "contributor": { "name": "Dave Cramer", "role": "mrk" }, "http://creativecommons.org/ns#attributionURL": "http://code.google.com/p/epub-samples/", "http://purl.org/dc/terms/rights": "This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.", "http://www.idpf.org/2007/opf#version": "3.0", "https://github.com/readium/go-toolkit#version": "v0.15.2-0.20260817093026-298d30dd8136", "identifier": "code.google.com.epub-samples.moby-dick-basic", "language": "en-US", "modified": "2012-01-18T12:47:00Z", "publisher": "Harper \u0026 Brothers, Publishers", "title": "Moby-Dick" }, "readingOrder": [ { "href": "OPS/titlepage.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/toc-short.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/preface_001.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/introduction_001.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/epigraph_001.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/chapter_001.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/chapter_002.xhtml", "type": "application/xhtml+xml" }, /*truncated*/ { "href": "OPS/chapter_136.xhtml", "type": "application/xhtml+xml" }, { "href": "OPS/copyright.xhtml", "type": "application/xhtml+xml" } ], "resources": [ { "href": "OPS/toc.ncx", "type": "application/x-dtbncx+xml" }, { "href": "OPS/fonts/STIXGeneral.otf", "type": "application/vnd.ms-opentype" }, { "href": "OPS/fonts/STIXGeneralItalic.otf", "type": "application/vnd.ms-opentype" }, { "href": "OPS/fonts/STIXGeneralBol.otf", "type": "application/vnd.ms-opentype" }, { "href": "OPS/fonts/STIXGeneralBolIta.otf", "type": "application/vnd.ms-opentype" }, { "href": "OPS/toc.xhtml", "rel": "contents", "type": "application/xhtml+xml" }, { "href": "OPS/cover.xhtml", "type": "application/xhtml+xml" }, { "height": 902, "href": "OPS/images/9780316000000.jpg", "properties": { "animated": false, "hash": [ { "algorithm": "sha256", "value": "8vGN3/kAP9BlkMbpSopoSLSMZWZWDW3d2G3ZRFubgdU=" } ], "references": [ { "description": "Cover Image", "href": "OPS/over.xhtml#css(body%20%3E%20div.body%20%3E%20img)", "role": [ "image" ] } ] }, "rel": "cover", "size": 348700, "type": "image/jpeg", "width": 646 }, { "href": "OPS/css/stylesheet.css", "type": "text/css" }, { "height": 1380, "href": "OPS/images/Moby-Dick_FE_title_page.jpg", "properties": { "animated": false, "hash": [ { "algorithm": "sha256", "value": "dJw6jaDD0O6tKBw29unMf1DxChpBiuWWbouTBZS+UlE=" } ], "references": [ { "description": "title page", "href": "OPS/titlepage.xhtml#css(body%20%3E%20div.BookTitlePage-rw%20%3E%20img)", "role": [ "image" ] } ] }, "size": 105155, "type": "image/jpeg", "width": 840 } ], "toc": [ { "href": "OPS/titlepage.xhtml", "title": "Moby-Dick" }, { "href": "OPS/preface_001.xhtml", "title": "Original Transcriber’s Notes:" }, { "href": "OPS/introduction_001.xhtml", "title": "ETYMOLOGY." }, { "href": "OPS/epigraph_001.xhtml", "title": "EXTRACTS (Supplied by a Sub-Sub-Librarian)." }, { "href": "OPS/chapter_001.xhtml", "title": "Chapter 1. Loomings." }, { "href": "OPS/chapter_002.xhtml", "title": "Chapter 2. The Carpet-Bag." }, /*truncated*/ { "href": "OPS/chapter_135.xhtml", "title": "Chapter 135. The Chase.—Third Day." }, { "href": "OPS/chapter_136.xhtml", "title": "Epilogue" }, { "href": "OPS/copyright.xhtml", "title": "Copyright Page" } ] }How does this look?
It looks pretty good to me.
Based on recent work in the Swift toolkit though, I think that having an output for both accessible name AND description could be useful.
Metadata
Metadata
Assignees
Labels
manifestRelated to the manifest commandRelated to the manifest command
With the on-going work on #180, we're now capable of detecting where an image is used, if it's decorative and which description (if any) is contained in the text.
This will be handled using a new
referencesobject inpropertiesthat can contain 1-n objects where:hreflinks to the resources and can contain a CSS selector as a fragment (hello.xhtml#css(body%20%3E%20span:nth-child(16)))descriptioncontains the image description (including blank ones, which is different from a missing description)rolewhere we mostly look forpresentation{ "href": "OPS/images/Moby-Dick_FE_title_page.jpg", "type": "image/jpeg", "size": 105155, "width": 840, "height": 1380, "properties": { "animated": false, "hash": [ { "algorithm": "sha256", "value": "dJw6jaDD0O6tKBw29unMf1DxChpBiuWWbouTBZS+UlE=" } ], "references": [ { "href": "hello.xhtml#css(body%20%3E%20span:nth-child(16))", "description": "This is the description of the image", "role": ["presentation"] } ] } }