Make web help topics lowercase for proper sorting

This commit is contained in:
Griatch 2021-07-26 22:05:26 +02:00
parent d00915d092
commit 52704d7c93
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -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