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和在线朗读,在线朗读可自定义
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)
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..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
@@ -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,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
+ * content src text/000001.html(当前章节)
+- * content src text/000001.html#toc_id_x (下一章节)
+ */
+ if (!nextUrl.isNullOrBlank() && res.href == nextUrl!!.substringBeforeLast("#")) break
} else if (isChapter) {
if (nextUrl.isNullOrBlank() || res.href == nextUrl.substringBeforeLast("#")) {
break
@@ -160,7 +163,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
@@ -311,18 +317,12 @@ class EpubFile(var book: Book) {
chapter.url = ref.completeHref
chapter.startFragmentId = ref.fragmentId
chapterList.lastOrNull()?.endFragmentId = chapter.startFragmentId
- /**
- * 二级目录判定
- * content src text/000001.html (二级目录)(上一章节)
- * content src text/000001.html#toc_id_x (当前章节)
- */
- val isVolume = chapter.url.substringBeforeLast("#") == chapterList.lastOrNull()?.url?.substringBeforeLast("#")
- 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)
}
}
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("")
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index 05070a103..6e95b867d 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 efd132172..aad299b97 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 0d74a298d..6aa240a76 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 0a6021e13..32b479fb6 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 d9817accb..3b62bdd38 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 e022a5320..216791d7e 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 f83086b26..f94211986 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
语速减
语速加
打开系统文件夹选择器出错,自动打开应用文件夹选择器