From 52704d7c93790af72baab2d53afba6c3c2ed8f66 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 26 Jul 2021 22:05:26 +0200 Subject: [PATCH] Make web help topics lowercase for proper sorting --- evennia/commands/default/help.py | 4 ++-- evennia/web/website/views/help.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index 5354440f4a..3589001245 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -816,9 +816,9 @@ class CmdSetHelp(CmdHelp): "with access to that command.") elif inherits_from(match, "evennia.help.filehelp.FileHelpEntry"): warning = (f"'{querystr}' matches (or partially matches) the name/alias of the " - "file-based help file '{match.key}'. File-help entries cannot be " + f"file-based help topic '{match.key}'. File-help entries cannot be " "modified from in-game (they are files on-disk). If you continue, " - "your help entry *may* shadow the file-based one's name partly or " + "your help entry may shadow the file-based one's name partly or " "completely.") if warning: # show a warning for a clashing help-entry type. Even if user accepts this diff --git a/evennia/web/website/views/help.py b/evennia/web/website/views/help.py index caa1fd911b..e92d6d2e1f 100644 --- a/evennia/web/website/views/help.py +++ b/evennia/web/website/views/help.py @@ -39,6 +39,7 @@ def get_help_category(help_entry, slugify_cat=True): # if one does not exist, create a category for ease of use with web views html templates if not hasattr(help_entry, 'web_help_category'): setattr(help_entry, 'web_help_category', slugify(help_category)) + help_category = help_category.lower() return slugify(help_category) if slugify_cat else help_category @@ -58,7 +59,7 @@ def get_help_topic(help_entry): # if one does not exist, create a key for ease of use with web views html templates if not hasattr(help_entry, 'web_help_key'): setattr(help_entry, 'web_help_key', slugify(help_topic)) - return help_topic + return help_topic.lower() def can_read_topic(cmd_or_topic, account): @@ -187,7 +188,7 @@ class HelpMixin(): all_entries = list(all_topics.values()) # sort the entries - all_entries = sorted(all_entries, key=get_help_topic) # sort alphabetically + all_entries.sort(key=get_help_topic) # sort alphabetically all_entries.sort(key=get_help_category) # group by categories return all_entries