🛠️ 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)
document.select("p").append("\n")
document.select("head > title").remove()
document
.body()
.select("p")
.append("\n")
.forEach { element ->
val cleanedText = element.html().replace(Regex("\\n+"), " ")
element.html(cleanedText)
}
document
.body()
.run {
fragment?.let { return@run getElementById(it) ?: this }
this