chore(ipub): example ipub file initial commit

This commit is contained in:
Guz
2025-07-31 19:18:28 -03:00
parent 642ac17c7a
commit ef0c5b0266
11 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:opf="http://www.idpf.org/2007/opf" unique-identifier="unique-identifier" version="3.0">
<metadata>
<dc:identifier id="unique-identifier">2b982cb2-7144-4aa2-aa86-f9f6ba47fa0d</dc:identifier>
<dc:title>Unknown Title</dc:title>
<dc:creator>Unknown Author</dc:creator>
<dc:language>en</dc:language>
<meta property="dcterms:modified">2025-07-31T15:14:16Z</meta>
<meta content="LibreOffice/25.2.5.2$Linux_X86_64 LibreOffice_project/03d19516eb2e1dd5d4ccd751a0d6f35f35e08022 (libepubgen/0.1.1)" name="generator"/>
</metadata>
<manifest>
<item href="images/image0001.png" id="image0001" media-type="image/png"/>
<item href="images/image0002.png" id="image0002" media-type="image/png"/>
<item href="images/image0003.png" id="image0003" media-type="image/png"/>
<item href="images/image0004.png" id="image0004" media-type="image/png"/>
<item href="styles/stylesheet.css" id="stylesheet.css" media-type="text/css"/>
<item href="toc.ncx" id="toc.ncx" media-type="application/x-dtbncx+xml"/>
<item href="toc.xhtml" id="toc.xhtml" media-type="application/xhtml+xml" properties="nav"/>
<item href="sections/section0001.xhtml" id="section0001" media-type="application/xhtml+xml"/>
</manifest>
<spine toc="toc.ncx">
<itemref idref="section0001"/>
</spine>
</package>

View File

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="x-ipub-version" content="1.0"/>
<link href="../styles/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body xmlns:epub="http://www.idpf.org/2007/ops" class="body">
<section data-ipub-element="page" id="page01">
<span data-ipub-element="image">
<img src="../images/image0001.png"/>
</span>
<!--
This in the UI would be an "Point Interaction" or just "Interaction". The
editor can just place it on some point the page, and adjust it's size.
The action is "open link", this action should have a warning to the reader,
to make sure they don't open malicious links.
-->
<!--
The "rel" will have "nofollow", "noopener" and "noreferrer" when the link
is to a domain different from the project's one.
-->
<a data-ipub-element="interaction" style="--ipub-x:6%;--ipub-y:88.5%;--ipub-size:3rem;--ipub-radius:100%;--ipub-origin-offset-x:-50%;--ipub-origin-offset-y:-50%;" id="int-httpsguzone" href="https://krita.org" target="_blank" referrerpolicy="same-origin" rel="external nofollow noopener noreferrer"><!--
This would be generated if the editor doesn't specify a accessibility text,
the in quotations text would be fetched from the site's title when the link is created
if possible.
-->
Go to "Krita | Digital Paiting. Creative Freedom"
</a>
<!--
This in the UI would be an "Area Interaction". The editor would first place
the first top-left point, and then the bottom-right one, to select an area/size
of the interaction.
The action is "go to page".
-->
<a data-ipub-element="interaction" style="--ipub-x:76%;--ipub-y:90%;--ipub-width:11.5%;--ipub-height:8%;" id="int-httpsguzone" href="section0001.xhtml#page03"><!--
This would be generated if the editor doesn't specify a accessibility text.
The in quotations text would be the title of the page if it has one, otherwise
it's ID is used (RFC, we could just place the text as "Go to page", since the IDs.
may not be human-readable).
-->
Go to page "page03"
</a>
</section>
<section data-ipub-element="page" id="page02">
<span data-ipub-element="image">
<img src="../images/image0002.png"/>
</span>
</section>
<section data-ipub-element="page" id="page03">
<span data-ipub-element="image">
<img src="../images/image0003.png"/>
</span>
</section>
<section data-ipub-element="page" id="page04">
<span data-ipub-element="image">
<img src="../images/image0004.png"/>
</span>
</section>
</body>
</html>

View File

@@ -0,0 +1,49 @@
.body {
-epub-writing-mode: horizontal-tb;
-webkit-writing-mode: horizontal-tb;
/* direction: ltr; */
direction: rtl;
writing-mode: horizontal-tb;
max-width: 100vw;
}
[data-ipub-element="page"] {
display: flex;
flex-direction: column;
position: relative;
}
[data-ipub-element="image"] {
width: var(--ipub-width, unset);
height: var(--ipub-width, unset);
}
[data-ipub-element="interaction"] {
position: absolute;
left: var(--ipub-x, 0%);
top: var(--ipub-y, 0%);
border-radius: var(--ipub-radius, unset);
width: var(--ipub-width, var(--ipub-size, unset));
height: var(--ipub-height, var(--ipub-size, unset));
transform: translate(
var(--ipub-origin-offset-x, 0%),
var(--ipub-origin-offset-y, 0%)
);
/*
* The opacity would be, by default, zero. Here it is 0.3 for easier debugging and
* showing of the example ebook
*/
background-color: red;
opacity: 0.3;
}
a[data-ipub-element="interaction"] {
/* The text inside the interaction anchor are for accessibility purposes */
font-size: 0px;
}
img {
max-width: 100%;
max-height: 100%;
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
<meta content="" name="" scheme=""/>
</head>
<docTitle>
<text/>
</docTitle>
<navMap>
<navPoint class="document" id="section1" playOrder="1">
<navLabel>
<text>Section 1</text>
</navLabel>
<content src="sections/section0001.xhtml"/>
</navPoint>
</navMap>
</ncx>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head/>
<body>
<nav epub:type="toc">
<ol>
<li>
<a href="sections/section0001.xhtml">Section 1</a>
</li>
</ol>
</nav>
</body>
</html>

BIN
.epub/example/example.epub Normal file

Binary file not shown.

1
.epub/example/mimetype Normal file
View File

@@ -0,0 +1 @@
application/epub+zip

View File

@@ -45,6 +45,12 @@
# S3
awscli
# ePUB
http-server
calibre
zip
unzip
];
};
});

View File

@@ -49,6 +49,19 @@ build: build/assets
run: build
./.dist/app
epub/example:
cd ./.epub/example; zip ./example.epub ./META-INF/container.xml ./OEBPS/* ./OEBPS/**/* ./mimetype
epub/example/server:
cd ./.epub/example; http-server
calibre:
mkdir -p ./tmp/calibre-library
calibre \
--no-update-check \
--with-library=./tmp/calibre-library \
./.epub/example/example.epub
clean:
# Remove generated directories
if [[ -d ".dist" ]]; then rm -r ./.dist; fi