From: Michael Tremer Date: Sun, 23 Oct 2022 12:51:01 +0000 (+0000) Subject: web: Always wrap any custom text into a content div X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc8a8ee7afb9c783e8bd151c3901134833229854;p=pbs.git web: Always wrap any custom text into a content div Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index c825c168..c014540b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -261,7 +261,8 @@ dist_templates_modules_DATA = \ src/templates/modules/commit-message.html \ src/templates/modules/link-to-user.html \ src/templates/modules/packages-files-table.html \ - src/templates/modules/source-table.html + src/templates/modules/source-table.html \ + src/templates/modules/text.html templates_modulesdir = $(templatesdir)/modules diff --git a/src/templates/builders/detail.html b/src/templates/builders/detail.html index 3cd393e5..29926877 100644 --- a/src/templates/builders/detail.html +++ b/src/templates/builders/detail.html @@ -80,9 +80,7 @@ {% end %} {% if builder.description %} -
- {% module Text(builder.description) %} -
+ {% module Text(builder.description) %} {% end %} diff --git a/src/templates/builds/show.html b/src/templates/builds/show.html index c5d31c1a..82003892 100644 --- a/src/templates/builds/show.html +++ b/src/templates/builds/show.html @@ -46,9 +46,7 @@

-
- {% module Text(build.message) %} -
+ {% module Text(build.message) %} {% end %} diff --git a/src/templates/distros/show.html b/src/templates/distros/show.html index 752a2e17..a3415935 100644 --- a/src/templates/distros/show.html +++ b/src/templates/distros/show.html @@ -22,9 +22,7 @@ {% if distro.description %}
-
- {% module Text(distro.description) %} -
+ {% module Text(distro.description) %} -
- {% module Text(package.description) %} -
+ {% module Text(package.description) %}
diff --git a/src/web/ui_modules.py b/src/web/ui_modules.py index f189be3f..8ef3ccee 100644 --- a/src/web/ui_modules.py +++ b/src/web/ui_modules.py @@ -21,13 +21,17 @@ class TextModule(UIModule): Renders the text through the Markdown processor """ def render(self, text): - return markdown.markdown(text, - extensions=[ - PrettyLinksExtension(), - "codehilite", - "fenced_code", - "sane_lists", - ]) + # Pass the text through a markdown processor + if text: + text = markdown.markdown(text, + extensions=[ + PrettyLinksExtension(), + "codehilite", + "fenced_code", + "sane_lists", + ]) + + return self.render_string("modules/text.html", text=text) class PrettyLinksExtension(markdown.extensions.Extension):