🛠️ Fix line breaking issues with EPUB
* Fixed line breaking issues
This commit is contained in:
parent
97b2db0bbc
commit
185af87efa
1 changed files with 9 additions and 2 deletions
|
|
@ -209,10 +209,17 @@ class EpubTextParser @Inject constructor() : TextParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
val document = Jsoup.parse(content)
|
val document = Jsoup.parse(content)
|
||||||
document.select("p").append("\n")
|
document
|
||||||
document.select("head > title").remove()
|
.body()
|
||||||
|
.select("p")
|
||||||
|
.append("\n")
|
||||||
|
.forEach { element ->
|
||||||
|
val cleanedText = element.html().replace(Regex("\\n+"), " ")
|
||||||
|
element.html(cleanedText)
|
||||||
|
}
|
||||||
|
|
||||||
document
|
document
|
||||||
|
.body()
|
||||||
.run {
|
.run {
|
||||||
fragment?.let { return@run getElementById(it) ?: this }
|
fragment?.let { return@run getElementById(it) ?: this }
|
||||||
this
|
this
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue