From b44ba889595002e7e902e01e2f6aa8006255c411 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 22 Jun 2023 10:10:38 +0200 Subject: 📝 update architecture graph - fix migration instruction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/views.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'ishtar_common/views.py') 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"

(.*) - (\d{4})-(\d{2})-(\d{2})

") 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 + #

v4.0.42 - 2023-01-25

+ 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"
" + changelog_full += f"{human_date(d)}" + changelog_full += f"{version}
" + context["changelog"] = changelog_full if page_number > 1: context["next"] = page_number - 1 -- cgit v1.2.3