From bf3aef348a0c7675d17cdeece24f1bde9cd1c843 Mon Sep 17 00:00:00 2001 From: Dylan Garrett Date: Sun, 26 Dec 2021 03:07:14 -0800 Subject: [PATCH] [plugin] Exporter: handle newlines in HTML highlight export (#8551) Based on some feedback from #8548 and #8535 This also sets the charset to UTF-8 to support more characters. --- plugins/exporter.koplugin/note.tpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/exporter.koplugin/note.tpl b/plugins/exporter.koplugin/note.tpl index 357e45199..6b2975c0c 100644 --- a/plugins/exporter.koplugin/note.tpl +++ b/plugins/exporter.koplugin/note.tpl @@ -44,8 +44,12 @@ local esc, _ = text:gsub('&', '&'):gsub('<', '<'):gsub('>', '>') return esc end + function newline_to_br(text) + return text:gsub("\n", "
") + end }# +

#{= htmlescape(booknotes.title) }#

#{= htmlescape(booknotes.author) }#
@@ -60,7 +64,7 @@ #{= os.date("%x", clipping.time) }##{ if clipping.chapter then }##{= clipping.chapter }#: #{ end }# #{= clipping.page }#
- #{= htmlescape(clipping.text) }# + #{= newline_to_br(htmlescape(clipping.text)) }# #{ if clipping.image then }# #{ end }# @@ -68,7 +72,7 @@ #{ if clipping.note then }#
#{= htmlescape(notemarks) }# - #{= htmlescape(clipping.note) }# + #{= newline_to_br(htmlescape(clipping.note)) }#
#{ end }#