Commit 7e8c91fc authored by Alf Eaton's avatar Alf Eaton

Rename "page" to "chapter"

fixes #6
parent a992b202
......@@ -21,16 +21,16 @@ class HTMLEPUB {
load (items) {
return Promise.mapSeries(items, (item, index) => {
return this.parse(item.content).then($ => {
const pageIndex = index + 1
const chapter = index + 1
const id = `page-${pageIndex}`
const id = `chapter-${chapter}`
const title = item.title || $('h1').text()
const target = `xhtml/${id}.xhtml`
this.xhtml[index] = { id, $, title, target }
this.extract($, pageIndex)
this.extract($, chapter)
})
})
}
......@@ -132,14 +132,14 @@ class HTMLEPUB {
})
}
extract ($, pageIndex) {
extract ($, chapter) {
const epub = this
const resourceRoot = epub.options.resourceRoot.replace(/\/?$/, '/') // ensure trailing slash
$('img[src]').each((index, node) => {
const $node = $(node)
const id = `image-${pageIndex}-${index}`
const id = `image-${chapter}-${index}`
const uri = $node.attr('src').replace(/^\//, '') // ensure no leading slash
const source = url.resolve(resourceRoot, uri)
......@@ -159,7 +159,7 @@ class HTMLEPUB {
$('head > link[rel="stylesheet"]').each((index, node) => {
const $node = $(node)
const id = `style-${pageIndex}-${index}`
const id = `style-${chapter}-${index}`
const uri = $node.attr('href').replace(/^\//, '') // ensure no leading slash
const source = url.resolve(resourceRoot, uri)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment