// canonical.json
["college-algebra" ,"precalculus" ,"algebra-and-trigonometry" ,"precalculus-coreq"]
and the temporary archive-syncfile
:
college-algebra col11759
precalculus col11667
algebra-and-trigonometry col11758
precalculus-coreq col32026
Both of these work, the advantage of the XML version is that it has schema validation and autocompletion
// META-INF/books.json
{
books: [
{ collection_id: 'col11759', href: '/collections/college-algebra.collection.xml', slug: 'college-algebra' },
{ collection_id: 'col11667', href: '/collections/precalculus.collection.xml', slug: 'precalculus' },
{ collection_id: 'col11758', href: '/collections/algebra-and-trigonometry.collection.xml', slug: 'algebra-and-trigonometry' },
{ collection_id: 'col32026', href: '/collections/precalculus-coreq.collection.xml', slug: 'precalculus-coreq' },
]
}
<!-- /META-INF/books.xml -->
<books version="1" xmlns="https://ns.openstax.org/books/manifest">
<book collection-id="col11759" href="/collections/college-algebra.collection.xml" id="college-algebra"/>
<book collection-id="col11667" href="/collections/precalculus.collection.xml" id="precalculus"/>
<book collection-id="col11758" href="/collections/algebra-and-trigonometry.collection.xml" id="algebra-and-trigonometry"/>
<book collection-id="col32026" href="/collections/precalculus-coreq.collection.xml" id="precalculus-coreq"/>
</books>
Corresponding EPUB file: /META-INF/container.xml
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile media-type="application/oebps-package+xml" full-path="collections/college-algebra.opf" />
<rootfile media-type="application/oebps-package+xml" full-path="collections/precalculus.opf" />
<rootfile media-type="application/oebps-package+xml" full-path="collections/algebra-and-trigonometry.opf" />
<rootfile media-type="application/oebps-package+xml" full-path="collections/precalculus-coreq.opf" />
</rootfiles>
</container>
<!--/collections/college-algebra.collection.xml -->
<collection xmlns="http://cnx.rice.edu/collxml">
<metadata xmlns:md="http://cnx.rice.edu/mdml" mdml-version="0.5">
<md:content-id>col11759</md:content-id>
<md:title>College Algebra</md:title>
<md:license url="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution License 4.0</md:license>
<md:uuid>9b08c294-057f-4201-9f48-5d6ad992740d</md:uuid>
<md:slug>college-algebra</md:slug>
</metadata>
<content>
<module document="m63490" version="latest" repository="https://legacy.cnx.org/content" cnxorg:version-at-this-collection-version="1.11">
<md:title>Preface</md:title>
</module>
<subcollection>
<!-- ... -->
</subcollection>
</content>
</collection>
Same for simplicity.
What we store in the collection.xml
file is two things: a ToC and book-specific metadata. an EPUB stores these in 2 separate files: a ToC file and an OPF file.
The TOC file is just an XHTML list of links inside a <nav>
element.
<!-- /collections/college-algebra.xhtml -->
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<nav id="toc">
<ul>
<li><a href="../modules/m63490.xhtml">Preface</a></li>
<ul>
<!-- ... -->
</ul>
</ul>
</nav>
</body>
</html>
The OPF file contains book-specific metadata as well as a link to the ToC file and a listing of all the assets in the book (HTML files and images). The list of assets can be autogenerated later and can be omitted from the repo:
<!-- /collections/college-algebra.opf -->
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier id="uid">9b08c294-057f-4201-9f48-5d6ad992740d</dc:identifier>
<dc:title>College Algebra</dc:title>
<dc:language>en</dc:language>
<os:slug>college-algebra</os:slug>
</metadata>
<manifest>
<item properties="nav" href="college-algebra.xhtml" media-type="application/xhtml+xml" />
<item properties="cover-image" href="./cover-image.svg" media-type="image/svg+xml" />
<!-- The following can be autopopulated during actual EPUB production -->
<item href="../modules/m1234/index.cnxml" media-type="text/cnxml+xml" />
<item href="../modules/m2345/index.cnxml" media-type="text/cnxml+xml" />
<item href="../modules/m1234/Figure_1_1.jpg" media-type="image/jpeg" />
<item href="../modules/m1234/Figure_1_2.jpg" media-type="image/jpeg" />
<item href="../modules/m1234/Figure_1_3.jpg" media-type="image/jpeg" />
</manifest>
</package>