pull/1125/head
gedoor 3 years ago
parent e6d667ce11
commit e0fe7124f9
  1. 16
      app/src/main/java/io/legado/app/model/localBook/EpubFile.kt

@ -139,19 +139,19 @@ class EpubFile(var book: Book) {
/*选择去除正文中的H标签,部分书籍标题与阅读标题重复待优化*/ /*选择去除正文中的H标签,部分书籍标题与阅读标题重复待优化*/
var tag = Book.hTag var tag = Book.hTag
if (book.getDelTag(tag)) { if (book.getDelTag(tag)) {
body.getElementsByTag("h1")?.remove() body.getElementsByTag("h1").remove()
body.getElementsByTag("h2")?.remove() body.getElementsByTag("h2").remove()
body.getElementsByTag("h3")?.remove() body.getElementsByTag("h3").remove()
body.getElementsByTag("h4")?.remove() body.getElementsByTag("h4").remove()
body.getElementsByTag("h5")?.remove() body.getElementsByTag("h5").remove()
body.getElementsByTag("h6")?.remove() body.getElementsByTag("h6").remove()
//body.getElementsMatchingOwnText(chapter.title)?.remove() //body.getElementsMatchingOwnText(chapter.title)?.remove()
} }
/*选择去除正文中的img标签,目前图片支持效果待优化*/ /*选择去除正文中的img标签,目前图片支持效果待优化*/
tag = Book.imgTag tag = Book.imgTag
if (book.getDelTag(tag)) { if (book.getDelTag(tag)) {
body.getElementsByTag("img")?.remove() body.getElementsByTag("img").remove()
} }
val elements = body.children() val elements = body.children()
@ -204,7 +204,7 @@ class EpubFile(var book: Book) {
val doc = val doc =
Jsoup.parse(String(resource.data, mCharset)) Jsoup.parse(String(resource.data, mCharset))
val elements = doc.getElementsByTag("title") val elements = doc.getElementsByTag("title")
if (elements != null && elements.size > 0) { if (elements.size > 0) {
title = elements[0].text() title = elements[0].text()
} }
} catch (e: IOException) { } catch (e: IOException) {

Loading…
Cancel
Save