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:
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':