View Single Post
Old 12-22-2020, 06:18 AM   #9
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,763
Karma: 731681
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
I only took a quick peek, but as @Galunid proposed perhaps the to plain text algorithm would behave more as expected like this (certainly a lot quicker than putting in an HTML widget):
Code:
diff --git a/frontend/util.lua b/frontend/util.lua
index 863ce849..6293e5c6 100644
--- a/frontend/util.lua
+++ b/frontend/util.lua
@@ -1002,8 +1002,8 @@ This may fail on complex HTML (with styles, scripts, comments), but should be fi
 function util.htmlToPlainText(text)
     -- Replace <br> and <p> with \n
     text = text:gsub("%s*<%s*br%s*/?>%s*", "\n") -- <br> and <br/>
-    text = text:gsub("%s*<%s*p%s*>%s*", "\n") -- <p>
-    text = text:gsub("%s*</%s*p%s*>%s*", "\n") -- </p>
+    text = text:gsub("%s*<%s*p%s*>%s*", "\n\n") -- <p>
+    text = text:gsub("%s*</%s*p%s*>%s*", "\n\n") -- </p>
     text = text:gsub("%s*<%s*p%s*/>%s*", "\n") -- standalone <p/>
     -- Remove all HTML tags
     text = text:gsub("<[^>]*>", "")
Frenzie is offline   Reply With Quote