Start adding new help documentation

This commit is contained in:
Griatch 2021-05-10 00:12:36 +02:00
parent 7e2a446bda
commit ebcff51932
7 changed files with 290 additions and 79 deletions

View file

@ -26,8 +26,8 @@ from evennia.utils.utils import (
from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
HELP_MORE = settings.HELP_MORE
CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES
HELP_MORE_ENABLED = settings.HELP_MORE_ENABLED
DEFAULT_HELP_CATEGORY = settings.DEFAULT_HELP_CATEGORY
# limit symbol import for API
__all__ = ("CmdHelp", "CmdSetHelp")
@ -83,8 +83,8 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
# Help messages are wrapped in an EvMore call (unless using the webclient
# with separate help popups) If you want to avoid this, simply add
# 'HELP_MORE = False' in your settings/conf/settings.py
help_more = HELP_MORE
# 'HELP_MORE_ENABLED = False' in your settings/conf/settings.py
help_more = HELP_MORE_ENABLED
# colors for the help index
index_type_separator_clr = "|w"
@ -572,9 +572,9 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
sethelp/replace pickpocketing, ,attr(is_thief) = This steals ...
sethelp/edit thievery
If not assigning a category, the "General" category will be used. If no
lockstring is specified, everyone will be able to read the help entry.
Sub-topics are embedded in the help text.
If not assigning a category, the `settings.DEFAULT_HELP_CATEGORY` category
will be used. If no lockstring is specified, everyone will be able to read
the help entry. Sub-topics are embedded in the help text.
Note that this cannot modify command-help entries - these are modified
in-code, outside the game.
@ -656,7 +656,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
lockstring = ",".join(lhslist[2:]) if nlist > 2 else old_entry.locks.get()
except Exception:
old_entry = None
category = lhslist[1] if nlist > 1 else "General"
category = lhslist[1] if nlist > 1 else DEFAULT_HELP_CATEGORY
lockstring = ",".join(lhslist[2:]) if nlist > 2 else "view:all()"
category = category.lower()

View file

@ -14,7 +14,7 @@ Each dict is on the form
::
{'key': <str>,
'category': <str>, # optional, otherwise settings.FILE_DEFAULT_HELP_CATEGORY
'category': <str>, # optional, otherwise settings.DEFAULT_HELP_CATEGORY
'aliases': <list>, # optional
'text': <str>}`` # the actual help text. Can contain # subtopic sections

View file

@ -13,7 +13,7 @@ Each help-entry dict is on the form
::
{'key': <str>,
'category': <str>, # optional, otherwise settings.FILE_DEFAULT_HELP_CATEGORY
'category': <str>, # optional, otherwise settings.DEFAULT_HELP_CATEGORY
'aliases': <list>, # optional
'text': <str>}``
@ -23,7 +23,7 @@ same form as other help entry-texts and contain ``# subtopics`` as normal.
New help-entry modules are added to the system by providing the python-path to
the module to `settings.FILE_HELP_ENTRY_MODULES`. Note that if same-key entries are
added, entries in latter modules will override that of earlier ones. Use
``settings.FILE_DEFAULT_HELP_CATEGORY`` to customize what category is used if
``settings.DEFAULT_HELP_CATEGORY`` to customize what category is used if
not set explicitly.
An example of the contents of a module:
@ -69,6 +69,8 @@ from evennia.utils.utils import (
variable_from_module, make_iter, all_from_module)
from evennia.utils import logger
_DEFAULT_HELP_CATEGORY = settings.DEFAULT_HELP_CATEGORY
@dataclass
class FileHelpEntry:
@ -144,7 +146,7 @@ class FileHelpStorageHandler:
for dct in loaded_help_dicts:
key = dct.get('key').lower().strip()
category = dct.get('category', settings.FILE_DEFAULT_HELP_CATEGORY).strip()
category = dct.get('category', _DEFAULT_HELP_CATEGORY).strip()
aliases = list(dct.get('aliases', []))
entrytext = dct.get('text')

View file

@ -589,11 +589,11 @@ TIME_IGNORE_DOWNTIMES = False
# Help output from CmdHelp are wrapped in an EvMore call
# (excluding webclient with separate help popups). If continuous scroll
# is preferred, change 'HELP_MORE' to False. EvMORE uses CLIENT_DEFAULT_HEIGHT
HELP_MORE = True
HELP_MORE_ENABLED = True
# The help category of a command if not specified.
COMMAND_DEFAULT_HELP_CATEGORY = "general"
# The help category of a file-based help entry if not specified
FILE_DEFAULT_HELP_CATEGORY = "general"
# The help category of a db or file-based help entry if not specified
DEFAULT_HELP_CATEGORY = "general"
# File-based help entries. These are modules containing dicts defining help
# entries. They can be used together with in-database entries created in-game.
FILE_HELP_ENTRY_MODULES = ["world.help_entries"]

View file

@ -1235,7 +1235,7 @@ _GA = object.__getattribute__
_SA = object.__setattr__
class DbHolder(object):
class DbHolder:
"Holder for allowing property access of attributes"
def __init__(self, obj, name, manager_name="attributes"):