From 484a3782f1530765a05b309dac96564d15e43ade Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 08:43:56 +0800
Subject: [PATCH 1/9] fix(LocalBook/EpubFile): skip to load Volume content
---
.../java/io/legado/app/model/localBook/EpubFile.kt | 11 +++++------
1 file changed, 5 insertions(+), 6 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 e39272287..791db518b 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
@@ -121,14 +121,11 @@ class EpubFile(var book: Book) {
}
private fun getContent(chapter: BookChapter): String? {
- val nextUrl = chapter.getVariable("nextUrl")
- val startFragmentId = chapter.startFragmentId
- val endFragmentId = chapter.endFragmentId
- /*当前章节resource href 和下一章href相同时 应该视为二级目录 返回空白*/
- //fix https://github.com/gedoor/legado/issues/1927 加载全部内容的bug
- if (chapter.isVolume) return ""
/*获取当前章节文本*/
epubBook?.let { epubBook ->
+ val nextUrl = chapter.getVariable("nextUrl")
+ val startFragmentId = chapter.startFragmentId
+ val endFragmentId = chapter.endFragmentId
val elements = Elements()
var isChapter = false
/*一些书籍依靠href索引的resource会包含多个章节,需要依靠fragmentId来截取到当前章节的内容*/
@@ -137,6 +134,8 @@ class EpubFile(var book: Book) {
if (chapter.url.substringBeforeLast("#") == res.href) {
elements.add(getBody(res, startFragmentId, endFragmentId))
isChapter = true
+ //fix https://github.com/gedoor/legado/issues/1927 加载全部内容的bug
+ if (chapter.isVolume) break
} else if (isChapter) {
if (nextUrl.isNullOrBlank() || res.href == nextUrl.substringBeforeLast("#")) {
break
From 0bc7341a180ee10991746e1ef9554f0352823e57 Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 10:34:54 +0800
Subject: [PATCH 2/9] fix(LocalBook/EpubFile): remove next chapter duplicated
title
---
app/src/main/java/io/legado/app/model/localBook/EpubFile.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 791db518b..ff5492b17 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
@@ -159,7 +159,10 @@ class EpubFile(var book: Book) {
body.getElementById(startFragmentId)?.previousElementSiblings()?.remove()
}
if (!endFragmentId.isNullOrBlank() && endFragmentId != startFragmentId) {
- body.getElementById(endFragmentId)?.nextElementSiblings()?.remove()
+ body.getElementById(endFragmentId)?.run {
+ nextElementSiblings()?.remove()
+ remove()
+ }
}
/*选择去除正文中的H标签,部分书籍标题与阅读标题重复待优化*/
val tag = Book.hTag
From a1991f21a2b40d07cac43c3b264b151cab60efde Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 11:08:48 +0800
Subject: [PATCH 3/9] fix(book/searchContent): search nothing if chineseConvert
enabled
---
.../legado/app/ui/book/searchContent/SearchContentViewModel.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentViewModel.kt b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentViewModel.kt
index 9eb680591..dd6914ddc 100644
--- a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentViewModel.kt
+++ b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentViewModel.kt
@@ -50,7 +50,7 @@ class SearchContentViewModel(application: Application) : BaseViewModel(applicati
}
mContent = contentProcessor!!.getContent(
book, chapter, chapterContent,
- chineseConvert = false,
+ chineseConvert = true,
reSegment = false,
useReplace = false
).joinToString("")
From 414ccc2b5272dbba5e63707e6704e06e6330566b Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 12:32:53 +0800
Subject: [PATCH 4/9] chore: update strings.xml
---
app/src/main/res/values-es-rES/strings.xml | 2 +-
app/src/main/res/values-ja-rJP/strings.xml | 2 +-
app/src/main/res/values-pt-rBR/strings.xml | 2 +-
app/src/main/res/values-zh-rHK/strings.xml | 2 +-
app/src/main/res/values-zh-rTW/strings.xml | 2 +-
app/src/main/res/values-zh/strings.xml | 2 +-
app/src/main/res/values/strings.xml | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index f42af61d0..69add3831 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -910,7 +910,7 @@
字体大小
当前字体大小:%.1f
search result
- search result is empty
+ Empty search result, check conversation settings
语速减
语速加
打开系统文件夹选择器出错,自动打开应用文件夹选择器
diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml
index 974b86c3d..4e1eb317c 100644
--- a/app/src/main/res/values-ja-rJP/strings.xml
+++ b/app/src/main/res/values-ja-rJP/strings.xml
@@ -913,7 +913,7 @@
字体大小
当前字体大小:%.1f
search result
- search result is empty
+ Empty search result, check conversation settings
语速减
语速加
打开系统文件夹选择器出错,自动打开应用文件夹选择器
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 02b040674..38ea6e187 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -911,7 +911,7 @@
字体大小
当前字体大小:%.1f
search result
- search result is empty
+ Empty search result, check conversation settings
语速减
语速加
打开系统文件夹选择器出错,自动打开应用文件夹选择器
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index a3975f06c..83d0f4c6e 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -904,7 +904,7 @@
是否使用外部瀏覽器打開?
查看
搜索結果
- 搜索結果为空
+ 搜索内容为空,检查净化/简繁设置
打開
刪除登錄頭
查看登錄頭
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 6980d349f..5b690a9a0 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -917,7 +917,7 @@
打開系統檔案選擇器出錯,自動打開應用文件選擇器
展開文字選擇選單
搜尋結果
- 搜尋結果為空
+ 搜索内容为空,检查净化/简繁设置
書籍儲存位置
從其它應用程式打開的書籍儲存位置
選擇儲存書籍的資料夾
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index d249d2ba1..4937409b4 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -780,7 +780,7 @@
更新时间排序
全文搜索
搜索结果
- 搜索结果为空
+ 搜索内容为空,检查净化/简繁设置
Empty now!
当前没有发现源!
将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5b6341758..6e7d84dcd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -913,7 +913,7 @@
font scale
font scale:%.1f
search result
- search result is empty
+ Empty search result, check conversation settings
语速减
语速加
打开系统文件夹选择器出错,自动打开应用文件夹选择器
From a8131d5362dbd809b32af948487a355b1b62b9cf Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 12:51:19 +0800
Subject: [PATCH 5/9] docs: update docs
---
app/src/main/assets/help/readMenuHelp.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/src/main/assets/help/readMenuHelp.md b/app/src/main/assets/help/readMenuHelp.md
index 85a976046..c916bf4c4 100644
--- a/app/src/main/assets/help/readMenuHelp.md
+++ b/app/src/main/assets/help/readMenuHelp.md
@@ -15,6 +15,10 @@
* 界面->所有排版设置都在里面
* 设置->其它一些设置,找不到的设置去这里看看,可滚动
+## 全文搜索
+搜索本地缓存或者本地文件,不能搜索在线内容
+如果搜索结果不符合预期,确保`替换净化`没有启用`内容替换`类规则(如替换主人公姓名)
+
## 朗读设置界面
* 后台->进入后台朗读,可以做一些其它事
* 设置->朗读引擎设置,可以切换本地TTS和在线朗读,在线朗读可自定义
From 72b0fd5a4700d69de5c3e81a7609d973ce5bb7d3 Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 14:04:18 +0800
Subject: [PATCH 6/9] fix: fail to remove duplicate title when content only has
title
---
app/src/main/java/io/legado/app/help/ContentProcessor.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/io/legado/app/help/ContentProcessor.kt b/app/src/main/java/io/legado/app/help/ContentProcessor.kt
index 466b348a6..d479a58f8 100644
--- a/app/src/main/java/io/legado/app/help/ContentProcessor.kt
+++ b/app/src/main/java/io/legado/app/help/ContentProcessor.kt
@@ -85,7 +85,7 @@ class ContentProcessor private constructor(
try {
val name = Pattern.quote(book.name)
val title = Pattern.quote(chapter.title)
- val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)+".toRegex()
+ val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)*".toRegex()
mContent = mContent.replace(titleRegex, "")
} catch (e: Exception) {
AppLog.put("去除重复标题出错\n${e.localizedMessage}", e)
From dd5b1fb488c7cf90356bc783aad64ff05eac5990 Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 17:48:05 +0800
Subject: [PATCH 7/9] fix(LocalBook/EpubFile): load all contents
---
.../java/io/legado/app/model/localBook/EpubFile.kt | 14 ++++++++------
1 file changed, 8 insertions(+), 6 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 ff5492b17..cf4bc1e3e 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
@@ -134,8 +134,12 @@ class EpubFile(var book: Book) {
if (chapter.url.substringBeforeLast("#") == res.href) {
elements.add(getBody(res, startFragmentId, endFragmentId))
isChapter = true
- //fix https://github.com/gedoor/legado/issues/1927 加载全部内容的bug
- if (chapter.isVolume) break
+ /**
+ * fix https://github.com/gedoor/legado/issues/1927 加载全部内容的bug
+ * content src text/000001.html(当前章节)
+- * content src text/000001.html#toc_id_x (下一章节)
+ */
+ if (res.href == nextUrl?.substringBeforeLast("#")) break
} else if (isChapter) {
if (nextUrl.isNullOrBlank() || res.href == nextUrl.substringBeforeLast("#")) {
break
@@ -314,11 +318,9 @@ class EpubFile(var book: Book) {
chapter.startFragmentId = ref.fragmentId
chapterList.lastOrNull()?.endFragmentId = chapter.startFragmentId
/**
- * 二级目录判定
- * content src text/000001.html (二级目录)(上一章节)
- * content src text/000001.html#toc_id_x (当前章节)
+ * 二级目录判定 todo
*/
- val isVolume = chapter.url.substringBeforeLast("#") == chapterList.lastOrNull()?.url?.substringBeforeLast("#")
+ val isVolume = false
chapterList.lastOrNull()?.isVolume = isVolume
chapterList.lastOrNull()?.putVariable("nextUrl", chapter.url)
chapterList.add(chapter)
From 8c3dead3ddd872f45cb32d7997c303c3d5b7f762 Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 19:35:01 +0800
Subject: [PATCH 8/9] =?UTF-8?q?feat(epub):=20=E8=AF=86=E5=88=AB=E5=A4=9A?=
=?UTF-8?q?=E7=BA=A7=E7=9B=AE=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/io/legado/app/model/localBook/EpubFile.kt | 6 +-----
1 file changed, 1 insertion(+), 5 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 cf4bc1e3e..6beb223a1 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
@@ -317,16 +317,12 @@ class EpubFile(var book: Book) {
chapter.url = ref.completeHref
chapter.startFragmentId = ref.fragmentId
chapterList.lastOrNull()?.endFragmentId = chapter.startFragmentId
- /**
- * 二级目录判定 todo
- */
- val isVolume = false
- chapterList.lastOrNull()?.isVolume = isVolume
chapterList.lastOrNull()?.putVariable("nextUrl", chapter.url)
chapterList.add(chapter)
durIndex++
}
if (ref.children != null && ref.children.isNotEmpty()) {
+ chapterList.lastOrNull()?.isVolume = true
parseMenu(chapterList, ref.children, level + 1)
}
}
From 59046456c664c7bf11630acc411db5053fb7f2e8 Mon Sep 17 00:00:00 2001
From: Xwite <1797350009@qq.com>
Date: Tue, 31 May 2022 19:57:24 +0800
Subject: [PATCH 9/9] fix(epub): fix
https://github.com/gedoor/legado/pull/1929/commits/dd5b1fb488c7cf90356bc783aad64ff05eac5990
---
app/src/main/java/io/legado/app/model/localBook/EpubFile.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 6beb223a1..0b6b06602 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,7 +139,7 @@ class EpubFile(var book: Book) {
* content src text/000001.html(当前章节)
- * content src text/000001.html#toc_id_x (下一章节)
*/
- if (res.href == nextUrl?.substringBeforeLast("#")) break
+ if (!nextUrl.isNullOrBlank() && res.href == nextUrl!!.substringBeforeLast("#")) break
} else if (isChapter) {
if (nextUrl.isNullOrBlank() || res.href == nextUrl.substringBeforeLast("#")) {
break