summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/templates/ishtar/changelog.html2
-rw-r--r--ishtar_common/views.py24
2 files changed, 24 insertions, 2 deletions
diff --git a/ishtar_common/templates/ishtar/changelog.html b/ishtar_common/templates/ishtar/changelog.html
index 1cc7a8b08..c11524d9d 100644
--- a/ishtar_common/templates/ishtar/changelog.html
+++ b/ishtar_common/templates/ishtar/changelog.html
@@ -2,7 +2,7 @@
{% load i18n %}
{% block content %}
<div class="container changelog">
- <h1>{% trans "Changelog" %}</h1>
+ <h1><i class="fa fa-code-fork" aria-hidden="true"></i>{% trans "Changelog" %}</h1>
{% if next %}
<div class="text-center">
<a class="btn btn-info" href="{% url 'changelog' next %}">{% trans "Next" %}</a>
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 73c516661..3f060f2e1 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -79,6 +79,7 @@ from ishtar_common.utils import (
dict_to_tuple,
put_session_message,
get_model_by_slug,
+ human_date,
)
from ishtar_common.widgets import JQueryAutoComplete
from ishtar_common import tasks
@@ -1215,8 +1216,29 @@ class ChangelogView(IshtarMixin, LoginRequiredMixin, TemplateView):
if not current_file:
raise Http404()
changelog_file = os.path.join(changelog_dir, current_file)
+ VERSION_RE = re.compile(r"<h2>(.*) - (\d{4})-(\d{2})-(\d{2})</h2>")
with open(changelog_file, "r", encoding="utf-8") as changelog:
- context["changelog"] = markdown(changelog.read())
+ changelog_base = markdown(changelog.read())
+ changelog_full = ""
+ for line in changelog_base.split("\n"):
+ line = line.strip()
+ if not line:
+ continue
+ # <h2>v4.0.42 - 2023-01-25</h2>
+ m = VERSION_RE.match(line)
+ if not m:
+ changelog_full += line
+ continue
+ version, year, month, day = m.groups()
+ try:
+ d = datetime.date(int(year), int(month), int(day))
+ except ValueError:
+ changelog_full += line
+ continue
+ changelog_full += f"<div id='{version}' class='version'>"
+ changelog_full += f"<span class='date'>{human_date(d)}</span>"
+ changelog_full += f"<span class='detail-version'>{version}</span></div>"
+ context["changelog"] = changelog_full
if page_number > 1:
context["next"] = page_number - 1