From 466a818df55a62185ac4f48d7908907bcc8e3510 Mon Sep 17 00:00:00 2001
From: "M. Taylor Saotome-Westlake" <ultimatelyuntruethought@gmail.com>
Date: Sun, 19 Apr 2020 16:01:46 -0700
Subject: [PATCH] =?utf8?q?exceptional-case=20tag=20sorting=20to=20treat=20?=
 =?utf8?q?=C3=A6=20ligature=20as=20"ae"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

I would hope that Unicode has standardized support for this need?—but
if I couldn't quickly find it, this will do.
---
 plugins/tag_cloud.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/plugins/tag_cloud.py b/plugins/tag_cloud.py
index 775977e..6672e2b 100644
--- a/plugins/tag_cloud.py
+++ b/plugins/tag_cloud.py
@@ -36,6 +36,15 @@ def init_default_config(pelican):
             set_default_settings(pelican.settings)
 
 
+def alphabetic_sort_key(element):
+    tag = element[0].name
+    if tag[0] == "æ":  # exceptional case
+        return "ae"+tag[1:]
+    # `.lower()` to avoid putting all uppercase tags lexicographically
+    # before lowercase tags —ZMD
+    return tag.lower()
+
+
 def generate_tag_cloud(generator):
     tag_cloud = defaultdict(int)
     for article in generator.articles:
@@ -69,9 +78,7 @@ def generate_tag_cloud(generator):
     sorting = generator.settings.get('TAG_CLOUD_SORTING')
 
     if sorting == 'alphabetically':
-        # `.lower()` to avoid putting all uppercase tags lexicographically
-        # before lowercase tags —ZMD
-        tag_cloud.sort(key=lambda elem: elem[0].name.lower())
+        tag_cloud.sort(key=alphabetic_sort_key)
     elif sorting == 'alphabetically-rev':
         tag_cloud.sort(key=lambda elem: elem[0].name, reverse=True)
     elif sorting == 'size':
-- 
2.17.1