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
1 change: 1 addition & 0 deletions bakery-js/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export const DIRNAMES = {
IO_DISASSEMBLE_LINKED: basename(
process.env['IO_DISASSEMBLE_LINKED'] || 'IO_DISASSEMBLE_LINKED'
),
BOOK_STYLES_ROOT: process.env['BOOK_STYLES_ROOT'],
}
4 changes: 3 additions & 1 deletion bakery-js/src/epub/__snapshots__/page.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Pages conversions converts a page that exercises a bunch of serializer
<body>


<h2 data-type="document-title">KinematicsInFourDimensions</h2>
<h1 data-type="document-title">KinematicsInFourDimensions</h1>
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">

</m:math>
Expand Down Expand Up @@ -50,6 +50,8 @@ exports[`Pages parses all the fields with a simple page 1`] = `
PageFile {
"_parsed": undefined,
"_readPath": "/pageLink1",
"ancestorTitle": null,
"ariaSpec": null,
},
],
"resources": [],
Expand Down
116 changes: 59 additions & 57 deletions bakery-js/src/epub/__snapshots__/toc.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,21 @@ exports[`TocFile and Friends Cover image with TocFile and Friends with an empty
<meta name="dtb:maxPageNumber" content="0"/>
</head>
<docTitle>
<text>booktitle
</text>
<text>booktitle</text>
</docTitle>
<navMap/></ncx>
<!-- # sourceMappingURL=thebooktoc.xhtml.map -->"
`;

exports[`TocFile and Friends Cover image with TocFile and Friends with an empty book generates an OPF file from an empty ToC file 1`] = `
"<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid">
<metadata>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">booktitle
</dc:title>
<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">language
</dc:language>
<meta property="dcterms:modified">2022-12-13
</meta>
<meta property="dcterms:license">http://licenseurl
</meta>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/" id="uid">dummy-openstax.org-id.bookslug
</dc:identifier>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">howdy
</dc:creator>
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>booktitle</dc:title>
<dc:language>language</dc:language>
<meta property="dcterms:modified">2022-12-13</meta>
<meta property="dcterms:license">http://licenseurl</meta>
<dc:identifier id="uid">dummy-openstax.org-id.bookslug</dc:identifier>
<dc:creator>howdy</dc:creator>
</metadata>
<manifest>
<item id="just-the-book-style" media-type="text/css" properties="remote-resources" href="the-style-epub.css"/>
Expand All @@ -56,6 +49,32 @@ exports[`TocFile and Friends Cover image with TocFile and Friends with an empty
<!-- # sourceMappingURL=thebooktoc.xhtml.map -->"
`;

exports[`TocFile and Friends with a small book captures data-toc-type for units, chapters, and pages 1`] = `
[
{
"children": [
{
"children": [
{
"page": "/foo/iamthepage.xhtml",
"title": "PageTitle",
"tocTargetType": "intro",
"tocType": "page",
"type": "LEAF",
},
],
"title": "ChapterTitle",
"tocType": "chapter",
"type": "INNER",
},
],
"title": "UnitTitle",
"tocType": "unit",
"type": "INNER",
},
]
`;

exports[`TocFile and Friends with a small book generates an NCX file 1`] = `
"<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
Expand All @@ -66,26 +85,22 @@ exports[`TocFile and Friends with a small book generates an NCX file 1`] = `
<meta name="dtb:maxPageNumber" content="2"/>
</head>
<docTitle>
<text>booktitle
</text>
<text>booktitle</text>
</docTitle>
<navMap>
<navPoint id="idm1">
<navPoint id="idm1" playOrder="1">
<navLabel>
<text>UnitTitle
</text>
<text>UnitTitle</text>
</navLabel>
<content src="../foo/iamthepage.xhtml"/>
<navPoint id="idm2">
<navPoint id="idm2" playOrder="2">
<navLabel>
<text>ChapterTitle
</text>
<text>ChapterTitle</text>
</navLabel>
<content src="../foo/iamthepage.xhtml"/>
<navPoint id="idm3">
<navPoint id="idm3" playOrder="3">
<navLabel>
<text>PageTitle
</text>
<text>PageTitle</text>
</navLabel>
<content src="./../foo/iamthepage.xhtml"/>
</navPoint>
Expand All @@ -97,19 +112,13 @@ exports[`TocFile and Friends with a small book generates an NCX file 1`] = `

exports[`TocFile and Friends with a small book generates an OPF file 1`] = `
"<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid">
<metadata>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">booktitle
</dc:title>
<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">language
</dc:language>
<meta property="dcterms:modified">2022-12-13
</meta>
<meta property="dcterms:license">http://licenseurl
</meta>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/" id="uid">dummy-openstax.org-id.bookslug
</dc:identifier>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">howdy
</dc:creator>
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>booktitle</dc:title>
<dc:language>language</dc:language>
<meta property="dcterms:modified">2022-12-13</meta>
<meta property="dcterms:license">http://licenseurl</meta>
<dc:identifier id="uid">dummy-openstax.org-id.bookslug</dc:identifier>
<dc:creator>howdy</dc:creator>
</metadata>
<manifest>
<item id="just-the-book-style" media-type="text/css" properties="remote-resources" href="the-style-epub.css"/>
Expand All @@ -133,13 +142,13 @@ exports[`TocFile and Friends with a small book parses a ToC with one page 1`] =
<body>
<nav epub:type="toc">
<ol>
<li>
<li data-toc-type="unit">
<a href="../foo/iamthepage.xhtml">UnitTitle</a>
<ol>
<li>
<li data-toc-type="chapter">
<a href="../foo/iamthepage.xhtml">ChapterTitle</a>
<ol>
<li>
<li data-toc-type="page" data-toc-target-type="intro">
<a href="../foo/iamthepage.xhtml">PageTitle</a>
</li>
</ol>
Expand All @@ -163,28 +172,21 @@ exports[`TocFile and Friends with an empty book generates an NCX file from an em
<meta name="dtb:maxPageNumber" content="0"/>
</head>
<docTitle>
<text>booktitle
</text>
<text>booktitle</text>
</docTitle>
<navMap/></ncx>
<!-- # sourceMappingURL=thebooktoc.xhtml.map -->"
`;

exports[`TocFile and Friends with an empty book generates an OPF file from an empty ToC file 1`] = `
"<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid">
<metadata>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">booktitle
</dc:title>
<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">language
</dc:language>
<meta property="dcterms:modified">2022-12-13
</meta>
<meta property="dcterms:license">http://licenseurl
</meta>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/" id="uid">dummy-openstax.org-id.bookslug
</dc:identifier>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">howdy
</dc:creator>
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>booktitle</dc:title>
<dc:language>language</dc:language>
<meta property="dcterms:modified">2022-12-13</meta>
<meta property="dcterms:license">http://licenseurl</meta>
<dc:identifier id="uid">dummy-openstax.org-id.bookslug</dc:identifier>
<dc:creator>howdy</dc:creator>
</metadata>
<manifest>
<item id="just-the-book-style" media-type="text/css" properties="remote-resources" href="the-style-epub.css"/>
Expand Down
Loading
Loading