diff options
| author | alex <alex@pdp7.net> | 2026-02-01 22:38:32 +0100 |
|---|---|---|
| committer | alexpdp7 <alex@corcoles.net> | 2026-02-01 22:39:10 +0100 |
| commit | c07273351f1be7fe517431c89f24443fa8246dee (patch) | |
| tree | 3fc30b9eeb6748ecf6e7a4f307a2a91fd357a3b7 /blog | |
| parent | a6f6398b7237c810a9ea1a890166d9ad693a6e80 (diff) | |
Fix ordering
Diffstat (limited to 'blog')
| -rw-r--r-- | blog/src/blog/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/blog/src/blog/__init__.py b/blog/src/blog/__init__.py index b50cb617..374bb85a 100644 --- a/blog/src/blog/__init__.py +++ b/blog/src/blog/__init__.py @@ -83,9 +83,10 @@ def build(from_: pathlib.Path, to: pathlib.Path): to.mkdir(parents=True, exist_ok=False) shutil.copytree(from_, to, dirs_exist_ok=True) - dated_entries = [b for b in to.glob("**/*.gmi") if re.match(r"\d{4}-\d{2}-\d{2}", b.read_text().splitlines()[1])] - dated_entries.sort() + dated_entries = [(b, b.read_text().splitlines()[1]) for b in to.glob("**/*.gmi") if re.match(r"\d{4}-\d{2}-\d{2}", b.read_text().splitlines()[1])] + dated_entries.sort(key=lambda t: t[1]) dated_entries.reverse() + dated_entries = [t[0] for t in dated_entries] # Generate index.gmi index = textwrap.dedent(f""" |
