diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-06-22 10:10:38 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-06-23 14:11:07 +0200 | 
| commit | b44ba889595002e7e902e01e2f6aa8006255c411 (patch) | |
| tree | 8b84f547701702fddad181f36f5644da22616827 /ishtar_common/views.py | |
| parent | 2f6edc5c331bc12a0b435ca01f3d1534dd6311d3 (diff) | |
| download | Ishtar-b44ba889595002e7e902e01e2f6aa8006255c411.tar.bz2 Ishtar-b44ba889595002e7e902e01e2f6aa8006255c411.zip  | |
📝 update architecture graph - fix migration instruction
Diffstat (limited to 'ishtar_common/views.py')
| -rw-r--r-- | ishtar_common/views.py | 24 | 
1 files changed, 23 insertions, 1 deletions
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  | 
