[tor-commits] [donate-static/staging] Move the index page to markdown

kez at torproject.org kez at torproject.org
Fri Jul 9 20:54:18 UTC 2021


commit cda2b9e4aa2b44a8b95ff6ce8fcb0a72286cfa6f
Author: kez <kez at torproject.org>
Date:   Fri Jul 9 16:50:36 2021 -0400

    Move the index page to markdown
---
 content/contents.lr       |  6 +++---
 templates/index-page.html | 12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/content/contents.lr b/content/contents.lr
index 27fbefc5..609582ad 100644
--- a/content/contents.lr
+++ b/content/contents.lr
@@ -10,13 +10,13 @@ section_id: donate
 ---
 title: Donate
 ---
-_template: donate-form.html
+_template: index-page.html
 ---
 intro:
 
-<p class="text-center mt-3 py-3 border"><a title="Champions of Privacy" href="champions-of-privacy">Donate more than $1000 and become a Champion of Privacy!</a></p>
-<p class="text-center mt-3 py-3 border"><a title="Cryptocurrency" href="cryptocurrency">Want to donate cryptocurrency?</a></p>
+[Donate more than $1000 and become a Champion of Privacy!](champions-of-privacy "Champions of Privacy")
 
+[Want to donate cryptocurrency?](cryptocurrency "Cryptocurrency")
 ---
 monthly_five: 10000
 ---
diff --git a/templates/index-page.html b/templates/index-page.html
new file mode 100644
index 00000000..cdce88ac
--- /dev/null
+++ b/templates/index-page.html
@@ -0,0 +1,12 @@
+{% extends "donate-form.html" %}
+{% block donate_form_intro %}
+{% for paragraph in this.intro.source.split('\n') %}
+  {% if paragraph|trim() != "" %}
+    {# `paragraph|markdown` will render the markdown in an additional set of <p> tags.
+       we need to trim whitespace, remove the opening and closing tags
+       (the `[3:-4]` slice drops the first 3 and last 4 characters),
+       and finally mark it as safe so the html isn't escaped #}
+      <p class="text-center mt-3 py-3 border">{{ (paragraph|markdown|trim)[3:-4]|safe }}</p>
+    {% endif %}
+  {% endfor %}
+{% endblock %}





More information about the tor-commits mailing list