From d5f66df2b33d84229330f60827488e954a6709b3 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 6 Jul 2020 20:48:21 +0200 Subject: [PATCH] Fixed api: reference shortcut --- .../Howto/Starting/Part1/Evennia-API-Overview.md | 5 ++++- .../api/evennia.contrib.tutorial_examples.mirror.rst | 7 +++++++ .../source/api/evennia.contrib.tutorial_examples.rst | 1 + docs/source/conf.py | 12 ++++++++---- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 docs/source/api/evennia.contrib.tutorial_examples.mirror.rst diff --git a/docs/source/Howto/Starting/Part1/Evennia-API-Overview.md b/docs/source/Howto/Starting/Part1/Evennia-API-Overview.md index dbd5777955..720b5ab26a 100644 --- a/docs/source/Howto/Starting/Part1/Evennia-API-Overview.md +++ b/docs/source/Howto/Starting/Part1/Evennia-API-Overview.md @@ -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 diff --git a/docs/source/api/evennia.contrib.tutorial_examples.mirror.rst b/docs/source/api/evennia.contrib.tutorial_examples.mirror.rst new file mode 100644 index 0000000000..d02f59d726 --- /dev/null +++ b/docs/source/api/evennia.contrib.tutorial_examples.mirror.rst @@ -0,0 +1,7 @@ +evennia.contrib.tutorial\_examples.mirror +================================================ + +.. automodule:: evennia.contrib.tutorial_examples.mirror + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/api/evennia.contrib.tutorial_examples.rst b/docs/source/api/evennia.contrib.tutorial_examples.rst index 8ae294a31d..d3618ea325 100644 --- a/docs/source/api/evennia.contrib.tutorial_examples.rst +++ b/docs/source/api/evennia.contrib.tutorial_examples.rst @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py index 907329cb2c..26d758fbbb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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