|
|
@ -6,10 +6,7 @@ import android.net.Uri |
|
|
|
import android.text.TextUtils |
|
|
|
import android.text.TextUtils |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.utils.FileUtils |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.MD5Utils |
|
|
|
|
|
|
|
import io.legado.app.utils.externalFilesDir |
|
|
|
|
|
|
|
import io.legado.app.utils.isContentPath |
|
|
|
|
|
|
|
import nl.siegmann.epublib.domain.Book |
|
|
|
import nl.siegmann.epublib.domain.Book |
|
|
|
import nl.siegmann.epublib.domain.TOCReference |
|
|
|
import nl.siegmann.epublib.domain.TOCReference |
|
|
|
import nl.siegmann.epublib.epub.EpubReader |
|
|
|
import nl.siegmann.epublib.epub.EpubReader |
|
|
@ -95,11 +92,7 @@ class EPUBFile(val book: io.legado.app.data.entities.Book) { |
|
|
|
val elements = doc.body().children() |
|
|
|
val elements = doc.body().children() |
|
|
|
elements.select("script").remove() |
|
|
|
elements.select("script").remove() |
|
|
|
elements.select("style").remove() |
|
|
|
elements.select("style").remove() |
|
|
|
return elements.outerHtml() |
|
|
|
return elements.outerHtml().htmlFormat() |
|
|
|
.replace("</?(?:div|p|b|br|hr|h\\d|article|dd|dl|span)[^>]*>".toRegex(), "\n") |
|
|
|
|
|
|
|
.replace("\\s*\\n+\\s*".toRegex(), "\n ") |
|
|
|
|
|
|
|
.replace("^[\\n\\s]+".toRegex(), " ") |
|
|
|
|
|
|
|
.replace("[\\n\\s]+$".toRegex(), "") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|