mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-05-19 20:03:53 +12:00
use the spread operator to fix a nasty bug for story 82748
This commit is contained in:
parent
a0f896c66d
commit
d5fa32303a
|
@ -82,42 +82,33 @@ export function createChapter (ffc, ch, isNotesChapter) {
|
||||||
sections.reverse()
|
sections.reverse()
|
||||||
}
|
}
|
||||||
|
|
||||||
const tokenContent = '%%HTML_CONTENT_' + Math.random() + '%%'
|
return render(
|
||||||
|
m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en', 'xml:lang': 'en' }, [
|
||||||
return Promise.all([
|
m('head', [
|
||||||
render(
|
m('meta', { charset: 'utf-8' }),
|
||||||
m('html', { xmlns: NS.XHTML, 'xmlns:epub': NS.OPS, lang: 'en', 'xml:lang': 'en' }, [
|
metaGenerator(),
|
||||||
m('head', [
|
m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/style.css' }),
|
||||||
m('meta', { charset: 'utf-8' }),
|
m('title', title)
|
||||||
metaGenerator(),
|
]),
|
||||||
m('link', { rel: 'stylesheet', type: 'text/css', href: '../Styles/style.css' }),
|
m('body', { 'epub:type': 'bodymatter chapter' }, m('div', [
|
||||||
m('title', title)
|
showHeadings ? m('.chapter-title', [
|
||||||
]),
|
!isNotesChapter && (showDuration || showWordCount) ? m('aside.info',
|
||||||
m('body', { 'epub:type': 'bodymatter chapter' }, m('div', [
|
showDuration ? m('span.label', ffc.options.wordsPerMinute ? calcReadingTime(ffc, ffc.storyInfo.chapters[index].realWordCount) : '') : null,
|
||||||
showHeadings ? m('.chapter-title', [
|
showWordCount ? m('span.label', ffc.storyInfo.chapters[index].realWordCount.toLocaleString('en-GB') + ' words') : null
|
||||||
!isNotesChapter && (showDuration || showWordCount) ? m('aside.info',
|
|
||||||
showDuration ? m('span.label', ffc.options.wordsPerMinute ? calcReadingTime(ffc, ffc.storyInfo.chapters[index].realWordCount) : '') : null,
|
|
||||||
showWordCount ? m('span.label', ffc.storyInfo.chapters[index].realWordCount.toLocaleString('en-GB') + ' words') : null
|
|
||||||
) : null,
|
|
||||||
m('header', m('h1', title)),
|
|
||||||
m('hr.old')
|
|
||||||
]) : null,
|
|
||||||
tokenContent,
|
|
||||||
(link || linkNotes || isNotesChapter) ? m('p.double', { style: 'text-align: center; clear: both;' },
|
|
||||||
link ? m('a.chaptercomments', { href: link + '#comment_list' }, 'Read chapter comments online') : null,
|
|
||||||
linkNotes ? m('a.chaptercomments', { href: linkNotes }, 'Read author\'s note') : null,
|
|
||||||
isNotesChapter ? m('a.chaptercomments', { href: './chapter_' + zeroFill(3, index + 1) + '.xhtml' }, 'Read chapter') : null
|
|
||||||
) : null,
|
) : null,
|
||||||
!isNotesChapter && ffc.options.addChapterBars ? chapterBars(ffc.storyInfo.chapters, index) : null
|
m('header', m('h1', title)),
|
||||||
]))
|
m('hr.old')
|
||||||
])
|
]) : null,
|
||||||
, { strict: true }),
|
...sections,
|
||||||
render(sections)
|
(link || linkNotes || isNotesChapter) ? m('p.double', { style: 'text-align: center; clear: both;' },
|
||||||
]).then(([chapterPage, sectionsData]) => {
|
link ? m('a.chaptercomments', { href: link + '#comment_list' }, 'Read chapter comments online') : null,
|
||||||
chapterPage = '<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html>\n' + chapterPage
|
linkNotes ? m('a.chaptercomments', { href: linkNotes }, 'Read author\'s note') : null,
|
||||||
chapterPage = chapterPage.replace(tokenContent, '\n' + sectionsData + '\n')
|
isNotesChapter ? m('a.chaptercomments', { href: './chapter_' + zeroFill(3, index + 1) + '.xhtml' }, 'Read chapter') : null
|
||||||
return chapterPage
|
) : null,
|
||||||
})
|
!isNotesChapter && ffc.options.addChapterBars ? chapterBars(ffc.storyInfo.chapters, index) : null
|
||||||
|
]))
|
||||||
|
])
|
||||||
|
, { strict: true }).then((chapterPage) => '<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html>\n' + chapterPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// some eReaders doesn't understand linear=no, so push those items to the end of the spine/book.
|
// some eReaders doesn't understand linear=no, so push those items to the end of the spine/book.
|
||||||
|
|
Loading…
Reference in a new issue