Merge pull request #949 from ag2s20150909/master

修复导出epub缺字
pull/951/head
kunfei 4 years ago committed by GitHub
commit 8812278b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt

@ -130,7 +130,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
val matches = AppPattern.imgPattern.toRegex().findAll(input = text) val matches = AppPattern.imgPattern.toRegex().findAll(input = text)
matches.forEach { matchResult -> matches.forEach { matchResult ->
matchResult.groupValues[1].let { matchResult.groupValues[1].let {
val src=NetworkUtils.getAbsoluteURL(chapter.url, it) val src = NetworkUtils.getAbsoluteURL(chapter.url, it)
srcList.add(Triple(chapter.title, index, src)) srcList.add(Triple(chapter.title, index, src))
} }
} }
@ -243,10 +243,8 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
BookHelp.getContent(book, chapter).let { content -> BookHelp.getContent(book, chapter).let { content ->
var content1 = fixPic(epubBook, book, content ?: "null", chapter) var content1 = fixPic(epubBook, book, content ?: "null", chapter)
content1 = contentProcessor content1 = contentProcessor
.getContent(book, chapter.title, content1, false, useReplace) .getContent(book, "", content1, false, useReplace)
.joinToString("\n") .joinToString("\n")
.replace(chapter.title, "")
epubBook.addSection( epubBook.addSection(
chapter.title, chapter.title,
ResourceUtil.createHTMLResource(chapter.title, content1) ResourceUtil.createHTMLResource(chapter.title, content1)
@ -275,7 +273,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
val matches = AppPattern.imgPattern.toRegex().findAll(input = text) val matches = AppPattern.imgPattern.toRegex().findAll(input = text)
matches.forEach { matchResult -> matches.forEach { matchResult ->
matchResult.groupValues[1].let { matchResult.groupValues[1].let {
val src=NetworkUtils.getAbsoluteURL(chapter.url, it) val src = NetworkUtils.getAbsoluteURL(chapter.url, it)
setPic(src, book, epubBook) setPic(src, book, epubBook)
text1 = text1.replace(src, MD5Utils.md5Encode16(src) + ".jpg") text1 = text1.replace(src, MD5Utils.md5Encode16(src) + ".jpg")

Loading…
Cancel
Save