There is some API to set all the meta-data, but the magic is in the way you can add sections. With sections you can add either all content with just one section, or finetune all the content so that it snugly fits the epub spec (with the various epub types described in the spec) and more importantly allows you to indicate exactly what should be included in the TOC and Landmarks section of the epub. You don't need to take care of all that, js-epub-maker will do that for you.
new EpubMaker()
.withUuid('github.com/bbottema/js-epub-maker::it-came-from::example-using-idpf-wasteland')
.withTemplate('idpf-wasteland')
.withAuthor('T. Est')
.withLanguage('en-GB')
.withModificationDate(new Date(2015, 8, 7))
.withRights({
description: 'This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.',
license: 'http://creativecommons.org/licenses/by-sa/3.0/'
})
.withAttributionUrl('https://github.com/bbottema/js-epub-maker')
.withStylesheetUrl('src/test/content-for-epub/extra_styles.css')
.withCover('src/test/content-for-epub/js-epub-maker-cover.jpg', {
license: 'http://creativecommons.org/licenses/by-sa/3.0/',
attributionUrl: 'http://www.webestools.com/web20-title-generator-logo-title-maker-online-web20-effect-reflect-free-photoshop.html'
})
.withTitle('It Came From... [Example Using Waste Land Template]')
.withSection(new EpubMaker.Section('frontmatter', 'frontmatter', { title: 'Title page' }, false, true)
.withSubSection(new EpubMaker.Section('titlepage', 'manuscript-header', header, false, false))
)
.withSection(new EpubMaker.Section('bodymatter', 'bodymatter', { title: 'Start of the story' }, false, true)
.withSubSection(new EpubMaker.Section('preface', 'preface', preface, true, false))
.withSubSection(new EpubMaker.Section('part', 'part-1', { title: 'Part 1' }, true, false)
.withSubSection(new EpubMaker.Section('chapter', 'chapter-1', ch1, true, false))
.withSubSection(new EpubMaker.Section('chapter', 'chapter-2', ch2, true, false))
)
.withSubSection(new EpubMaker.Section('part', 'part-2', { title: 'Part 2' }, true, false)
.withSubSection(new EpubMaker.Section('chapter', 'chapter-3', ch3, true, false))
.withSubSection(new EpubMaker.Section('chapter', 'chapter-4', ch4, true, false))
)
)
.withSection(new EpubMaker.Section('backmatter', 'backmatter', { title: 'Notes and rest' }, false, true)
.withSubSection(new EpubMaker.Section('rearnotes', 'rear-notes', { title: 'Notes on "It Came From"' }, true, false)
.withSubSection(new EpubMaker.Section('rearnote', 'rearnote-1', rn1, false, false))
.withSubSection(new EpubMaker.Section('rearnote', 'rearnote-2', rn2, false, false))
)
)
.downloadEpub();