pull/423/head
gedoor 4 years ago
parent b67bb916ef
commit d42d738d67
  1. 5
      app/src/main/java/io/legado/app/help/BookHelp.kt
  2. 2
      app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt

@ -322,11 +322,10 @@ object BookHelp {
}
val contents = arrayListOf<String>()
c.split("\n").forEach {
val str = it.replace("^\\s+".toRegex(), "")
.replace("\r", "")
val str = it.replace("^[\\n\\s\\r]+".toRegex(), "")
if (contents.isEmpty()) {
contents.add(title)
if (str != title && it.isNotEmpty()) {
if (str != title && str.isNotEmpty()) {
contents.add("${ReadBookConfig.paragraphIndent}$str")
}
} else if (str.isNotEmpty()) {

@ -261,6 +261,8 @@ class AnalyzeTxtFile {
bookStream.seek(bookChapter.start!!)
bookStream.read(content)
return String(content, book.fileCharset())
.substringAfter(bookChapter.title)
.replace("^[\\n\\s]+".toRegex(), "  ")
}
private fun getBookFile(book: Book): File {

Loading…
Cancel
Save