🛠️ Fix line breaking issues with EPUB

* Fixed line breaking issues
This commit is contained in:
Acclorite 2024-09-18 19:27:39 +03:00
parent 97b2db0bbc
commit 185af87efa

View file

@ -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