This commit is contained in:
Xwite
2023-03-10 21:50:12 +08:00
parent b0e299d347
commit 3dd64a611b
@@ -148,18 +148,22 @@ class EpubFile(var book: Book) {
for (res in epubBook.contents) { for (res in epubBook.contents) {
if (!findChapterFirstSource) { if (!findChapterFirstSource) {
if (chapter.url == res.href) findChapterFirstSource = true if (chapter.url == res.href) findChapterFirstSource = true
// add first resource to elements // 第一个xhtml文件
elements.add( elements.add(
/* pass endFragmentId if only has one resource */
getBody(res, startFragmentId, endFragmentId) getBody(res, startFragmentId, endFragmentId)
) )
if (chapter.url == nextUrl) break if (chapter.url == nextUrl) break
continue continue
} }
if (nextUrl != res.href) { if (nextUrl != res.href) {
// 其余部分
elements.add(getBody(res, null, null)) elements.add(getBody(res, null, null))
} else { } else {
elements.add(getBody(res, null, endFragmentId)) // 下一章节的第一个xhtml
if (!endFragmentId.isNullOrBlank()) {
//有Fragment 则添加到上一章节
elements.add(getBody(res, null, endFragmentId))
}
break break
} }
} }