Fixed api: reference shortcut

This commit is contained in:
Griatch 2020-07-06 20:48:21 +02:00
parent a8f56f4370
commit d5f66df2b3
4 changed files with 20 additions and 5 deletions

View file

@ -21,7 +21,7 @@ The Evennia _API_
([Application Programming Interface](https://en.wikipedia.org/wiki/Application_programming_interface)) is what
you use to access things inside the `evennia` package. You can examine this in many ways:
- The easiest is to browse the [API auto-docs](api:evennia) coming with this very documentation. This is built
- The easiest is to browse the [API auto-docs](../../../Evennia-API) [api](api:evennia) coming with this very documentation. This is built
automatically from the latest sources. The auto-docs give you each class, function and method along with the
docstring and everything you need to use that resource. If you want to go deeper you can also click the `[src]`
link next to e.g. a class to see its full python code. The documentation is also searchable.
@ -63,6 +63,9 @@ want to learn more about how this works.
# Tutorial Searching For Objects
You will often want to operate on a specific object in the database. For example when a player

View file

@ -0,0 +1,7 @@
evennia.contrib.tutorial\_examples.mirror
================================================
.. automodule:: evennia.contrib.tutorial_examples.mirror
:members:
:undoc-members:
:show-inheritance:

View file

@ -15,6 +15,7 @@ Submodules
evennia.contrib.tutorial_examples.bodyfunctions
evennia.contrib.tutorial_examples.cmdset_red_button
evennia.contrib.tutorial_examples.example_batch_code
evennia.contrib.tutorial_examples.mirror
evennia.contrib.tutorial_examples.red_button
evennia.contrib.tutorial_examples.red_button_scripts
evennia.contrib.tutorial_examples.tests

View file

@ -117,12 +117,12 @@ _github_issue_choose = "https://github.com/evennia/evennia/issues/new/choose"
def url_resolver(url):
"""
Convert urls by catching special markers.
Convert urls by catching special markers.
"""
githubstart = "github:"
apistart = "api:"
choose_issue = "github:issue"
if url.endswith(choose_issue):
return _github_issue_choose
elif githubstart in url:
@ -131,8 +131,12 @@ def url_resolver(url):
urlpath = "master/" + urlpath
return _github_code_root + urlpath
elif apistart in url:
urlpath = url[url.index(apistart) + len(apistart):]
return "api/" + urlpath + ".html"
# locate the api/ folder in the doc structure
ind = url.index(apistart)
depth = url[:ind].count("/") + 1
path = "../".join("" for _ in range(depth))
urlpath = path + "api/" + url[ind + len(apistart):] + ".html"
return urlpath
return url