diff --git a/frontend/util.lua b/frontend/util.lua index 863ce8495..3e487057f 100644 --- a/frontend/util.lua +++ b/frontend/util.lua @@ -1002,7 +1002,7 @@ This may fail on complex HTML (with styles, scripts, comments), but should be fi function util.htmlToPlainText(text) -- Replace
and

with \n text = text:gsub("%s*<%s*br%s*/?>%s*", "\n") --
and
- text = text:gsub("%s*<%s*p%s*>%s*", "\n") --

+ text = text:gsub("%s*<%s*p%s*>%s*", "\n    ") --

text = text:gsub("%s*%s*", "\n") --

text = text:gsub("%s*<%s*p%s*/>%s*", "\n") -- standalone

-- Remove all HTML tags @@ -1012,6 +1012,8 @@ function util.htmlToPlainText(text) -- Trim spaces and new lines at start and end text = text:gsub("^[\n%s]*", "") text = text:gsub("[\n%s]*$", "") + -- Trim non-breaking spaces from the start + text = text:gsub("^\xC2\xA0\xC2\xA0\xC2\xA0\xC2\xA0", "") return text end