From e0fe7124f9aa75c4a90ff4f5be91ef8204f12d6e Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Jul 2021 21:25:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/localBook/EpubFile.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt index 93f96132f..c4be8584e 100644 --- a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt @@ -139,19 +139,19 @@ class EpubFile(var book: Book) { /*选择去除正文中的H标签,部分书籍标题与阅读标题重复待优化*/ var tag = Book.hTag if (book.getDelTag(tag)) { - body.getElementsByTag("h1")?.remove() - body.getElementsByTag("h2")?.remove() - body.getElementsByTag("h3")?.remove() - body.getElementsByTag("h4")?.remove() - body.getElementsByTag("h5")?.remove() - body.getElementsByTag("h6")?.remove() + body.getElementsByTag("h1").remove() + body.getElementsByTag("h2").remove() + body.getElementsByTag("h3").remove() + body.getElementsByTag("h4").remove() + body.getElementsByTag("h5").remove() + body.getElementsByTag("h6").remove() //body.getElementsMatchingOwnText(chapter.title)?.remove() } /*选择去除正文中的img标签,目前图片支持效果待优化*/ tag = Book.imgTag if (book.getDelTag(tag)) { - body.getElementsByTag("img")?.remove() + body.getElementsByTag("img").remove() } val elements = body.children() @@ -204,7 +204,7 @@ class EpubFile(var book: Book) { val doc = Jsoup.parse(String(resource.data, mCharset)) val elements = doc.getElementsByTag("title") - if (elements != null && elements.size > 0) { + if (elements.size > 0) { title = elements[0].text() } } catch (e: IOException) {