From a0892adf1caf26c6e5e81e41097aa6f5415f9355 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Tue, 22 Jun 2021 00:55:39 +0200
Subject: [PATCH] elections2021: Format headings between checks

---
 .../elections2021_program_point_page.html             |  4 ++--
 elections2021/templatetags/elections2021_extras.py    | 11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/elections2021/templates/elections2021/elections2021_program_point_page.html b/elections2021/templates/elections2021/elections2021_program_point_page.html
index e5e236a7..1a70dcb8 100644
--- a/elections2021/templates/elections2021/elections2021_program_point_page.html
+++ b/elections2021/templates/elections2021/elections2021_program_point_page.html
@@ -151,7 +151,7 @@
 
       <h3 class="head-alt-base mb-8">Jak to chceme udělat?</h3>
       <div class="content-block">
-        {{ page.proposal|richtext|format_sources }}
+        {{ page.proposal|richtext|format_sources|style_h4 }}
       </div>
 
       <div id="kolik-na-to-chceme-casu" class="grid grid-cols-1 gap-8 my-20">
@@ -211,7 +211,7 @@
 
       <h3 id="co-pro-to-uz-delame" class="head-alt-base mt-20 mb-10">Co pro to už děláme</h3>
       <div class="content-block">
-        {{ page.already_done|richtext|format_sources }}
+        {{ page.already_done|richtext|format_sources|style_h4 }}
       </div>
 
       <h3 id="na-co-se-nas-casto-ptate" class="head-alt-base mb-8 mt-20">Na co se nás často ptáte</h3>
diff --git a/elections2021/templatetags/elections2021_extras.py b/elections2021/templatetags/elections2021_extras.py
index 4f8feb0c..762674ef 100644
--- a/elections2021/templatetags/elections2021_extras.py
+++ b/elections2021/templatetags/elections2021_extras.py
@@ -55,7 +55,7 @@ def format_sources_block(value):
 def format_sources(value):
     soup = bs4.BeautifulSoup(value, "html.parser")
     for sup in soup.find_all("sup"):
-        sup.wrap(soup.new_tag("a", id="reference", href="#zdroje"))
+        sup.wrap(soup.new_tag("a", href="#zdroje"))
     return str(soup)
 
 
@@ -71,3 +71,12 @@ def strip_sup(value):
 @register.filter
 def dictitem(dictionary, key):
     return dictionary.get(key)
+
+
+@register.filter(is_safe=True)
+@stringfilter
+def style_h4(value):
+    soup = bs4.BeautifulSoup(value, "html.parser")
+    for h4 in soup.find_all("h4"):
+        h4["class"] = "pl-11 font-bold text-xl mb-4"
+    return str(soup)
-- 
GitLab