diff --git a/elections2021/templates/elections2021/elections2021_program_page.html b/elections2021/templates/elections2021/elections2021_program_page.html index a06953d0b8abea6d42482622e59d34b7a72ed6ba..4e2993aaf6b4c8224876dfd9f3615f7c69e1f996 100644 --- a/elections2021/templates/elections2021/elections2021_program_page.html +++ b/elections2021/templates/elections2021/elections2021_program_page.html @@ -1,5 +1,5 @@ {% extends "elections2021/base.html" %} -{% load static wagtailcore_tags wagtailimages_tags wagtailroutablepage_tags %} +{% load static wagtailcore_tags wagtailimages_tags wagtailroutablepage_tags elections2021_extras %} {% block content_header %} @@ -110,7 +110,7 @@ <div class="card icon-card shadow-none bg-grey-125 card--hoveractive" data-archetype="{% if show_archetype_icon %}{{ point.archetype }}{% endif %}"> <div class="card__body"> <h1 class="card-headline mb-8"><a href="{% pageurl point %}">{{ point.title }}</a></h1> - <div class="card-body-text">{{ point.annotation|richtext }}</div> + <div class="card-body-text"><a href="{% pageurl point %}">{{ point.annotation|richtext|strip_sup }}</a></div> </div> </div> diff --git a/elections2021/templatetags/elections2021_extras.py b/elections2021/templatetags/elections2021_extras.py index 9f510afd66d1b7075ba289d86683c0adb6db4aba..7a43be23fceccf6b3e4c6c0cdec04414042f0db6 100644 --- a/elections2021/templatetags/elections2021_extras.py +++ b/elections2021/templatetags/elections2021_extras.py @@ -57,3 +57,12 @@ def format_sources(value): for sup in soup.find_all("sup"): sup.wrap(soup.new_tag("a", id="reference", href="#zdroje")) return str(soup) + + +@register.filter(is_safe=True) +@stringfilter +def strip_sup(value): + soup = bs4.BeautifulSoup(value, "html.parser") + for sup in soup.find_all("sup"): + sup.decompose() + return str(soup)