8000 Ids in package.opf are not valid when images are encoded in base64 · Issue #371 · asciidoctor/asciidoctor-epub3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Ids in package.opf are not valid when images are encoded in base64 #371
Closed
@agoncal

Description

@agoncal

Take the following document:

= Test

This is an image <<commons-figure-asciidoc>>.

[[commons-figure-asciidoc]]
.Author
image::commons-figure-asciidoc.png[]

Once you generated the EPUB version, the image in package.opf as a valid id (here, the nane of the caption):

<item href="./images/commons-figure-asciidoc.png" id="item_commons-figure-asciidoc" media-type="image/png"/>

But when you set :data-uri: the id is invalid. Take the following doc:

= Test
:data-uri:

This is an image <<commons-figure-asciidoc>>.

[[commons-figure-asciidoc]]
.Author
image::commons-figure-asciidoc.png[]

Now, if you check the package.opf you can see the base64 format of the image. The id is set to the last characters of the base64 (here AyouyzE6v5n4AAAAAElFTkSuQmCC==).

<item href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACMAAAAanCAIAA.../AyouyzE6v5n4AAAAAElFTkSuQmCC==" id="item_AyouyzE6v5n4AAAAAElFTkSuQmCC==" media-type=""/>

When you run EPUBCheck, you get the following error. The id attribute is not valid XML:

<message id="RSC-005" severity="error">RSC-005, ERROR, [Error while parsing file: value of attribute "id" is invalid; must be an XML name without colons], EPUB/package.opf (50-1127779)</message>

The generated id should be XML valid so we don't get this kind of messages

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0