From 6a3066b399a2278af2d6b891abb7ef382aa2c45e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 12 Feb 2025 11:36:08 +0000 Subject: [PATCH] packages: Remove trailing dots from summaries Signed-off-by: Michael Tremer --- src/templates/builds/macros.html | 2 +- src/templates/builds/show.html | 2 +- src/web/base.py | 1 + src/web/filters.py | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/templates/builds/macros.html b/src/templates/builds/macros.html index 3bddfc22..813b1473 100644 --- a/src/templates/builds/macros.html +++ b/src/templates/builds/macros.html @@ -164,7 +164,7 @@ {# Show the summary in a second line #}

- {{ pkg.summary }} + {{ pkg.summary | summary }}

diff --git a/src/templates/builds/show.html b/src/templates/builds/show.html index 069f3008..ac4112ad 100644 --- a/src/templates/builds/show.html +++ b/src/templates/builds/show.html @@ -50,7 +50,7 @@ {% else %}
- {{ build.pkg.summary }} + {{ build.pkg.summary | summary }}
{% endif %} diff --git a/src/web/base.py b/src/web/base.py index c8c8f2de..4a96160c 100644 --- a/src/web/base.py +++ b/src/web/base.py @@ -316,6 +316,7 @@ class BaseHandler(tornado.web.RequestHandler): "hostname" : filters.hostname, "markdown" : filters._markdown, "static_url" : filters.static_url, + "summary" : filters.summary, # Add some Python built-ins "dir" : dir, diff --git a/src/web/filters.py b/src/web/filters.py index 044a98fa..438f6e30 100644 --- a/src/web/filters.py +++ b/src/web/filters.py @@ -182,3 +182,9 @@ def static_url(ctx, *args, **kwargs): handler = ctx.get("handler") return handler.static_url(*args, **kwargs) + +def summary(summary): + """ + Removes any trailing full stops + """ + return summary.removesuffix(".") -- 2.47.2