🛠️ 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)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue