From 98fb2948fc75c40b87ad5c9e1c27662e3193fca3 Mon Sep 17 00:00:00 2001 From: Stefan Schallerl Date: Thu, 13 Feb 2025 18:03:13 +0100 Subject: [PATCH] Displays description as pre-text, so formatting (i.e. indentation, newlines) is displayed. --- .../main/kotlin/net/h34t/filemure/TemplateModifiers.kt | 10 +++++++++- .../main/tpl/net.h34t.filemure.tpl/Document.tpl.html | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/net/h34t/filemure/TemplateModifiers.kt b/app/src/main/kotlin/net/h34t/filemure/TemplateModifiers.kt index 9901b46..b2bcda2 100644 --- a/app/src/main/kotlin/net/h34t/filemure/TemplateModifiers.kt +++ b/app/src/main/kotlin/net/h34t/filemure/TemplateModifiers.kt @@ -8,12 +8,20 @@ class TemplateModifiers : Frame.Modifiers, Limbo.Modifiers, DocumentCreateForm.M FilePreview.Modifiers, DocumentEditForm.Modifiers, FileList.Modifiers, net.h34t.filemure.tpl.Document.Modifiers, OverviewDocuments.Modifiers, Search.Modifiers, Tags.Modifiers { + private val linebreaks = Regex("\\v+") + fun hashPrefix(arg: String): String { return URLEncoder.encode(arg, Charsets.UTF_8) } - override fun starPrefix(arg: String): String { + override fun starPrefix(arg: String) = html(arg) + + override fun html(arg: String): String { return StringEscapeUtils.escapeHtml4(arg) } + +// override fun nl2br(arg: String): String { +// return arg.replace(linebreaks, "
\n") +// } } diff --git a/app/src/main/tpl/net.h34t.filemure.tpl/Document.tpl.html b/app/src/main/tpl/net.h34t.filemure.tpl/Document.tpl.html index 2c95545..a46a405 100644 --- a/app/src/main/tpl/net.h34t.filemure.tpl/Document.tpl.html +++ b/app/src/main/tpl/net.h34t.filemure.tpl/Document.tpl.html @@ -12,7 +12,7 @@
Description -
{*$description}
+
{$description|html}