[Docs] Change links to d.py docs to use pinned version instead of v1.0.1. (#3053)

* docs: change links to d.py docs to use stable version instead of v1.0.1

* chore(changelog): add towncrier entry

* docs: add |DPY_VERSION| substitution and :dpy_docs: role

* chore(changelog): update towncrier entries to reflect new changes
This commit is contained in:
jack1142 2019-10-17 13:58:39 +02:00 committed by Michael H
parent a9a547e56d
commit 172dd58903
6 changed files with 16 additions and 4 deletions

View File

@ -0,0 +1 @@
Discord.py docs links will now always use docs for currently used version of discord.py.

View File

@ -0,0 +1 @@
Add ``|DPY_VERSION|`` substitution that will automatically get replaced by current discord.py version.

View File

@ -36,6 +36,7 @@ os.environ["BUILDING_DOCS"] = "1"
# ones. # ones.
extensions = [ extensions = [
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx", "sphinx.ext.intersphinx",
"sphinx.ext.viewcode", "sphinx.ext.viewcode",
"sphinx.ext.napoleon", "sphinx.ext.napoleon",
@ -65,6 +66,7 @@ author = "Cog Creators"
# built documents. # built documents.
# #
from redbot.core import __version__ from redbot.core import __version__
from discord import __version__ as dpy_version
# The short X.Y version. # The short X.Y version.
version = __version__ version = __version__
@ -96,6 +98,9 @@ default_role = "any"
with open("prolog.txt", "r") as file: with open("prolog.txt", "r") as file:
rst_prolog = file.read() rst_prolog = file.read()
# Adds d.py version to available substitutions in all files
rst_prolog = f"\n.. |DPY_VERSION| replace:: {dpy_version}"
# -- Options for HTML output ---------------------------------------------- # -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
@ -209,10 +214,15 @@ linkcheck_ignore = [r"https://java.com*", r"https://chocolatey.org*"]
# Intersphinx # Intersphinx
intersphinx_mapping = { intersphinx_mapping = {
"python": ("https://docs.python.org/3", None), "python": ("https://docs.python.org/3", None),
"dpy": ("https://discordpy.readthedocs.io/en/v1.0.1/", None), "dpy": (f"https://discordpy.readthedocs.io/en/v{dpy_version}/", None),
"motor": ("https://motor.readthedocs.io/en/stable/", None), "motor": ("https://motor.readthedocs.io/en/stable/", None),
} }
# Extlinks
# This allows to create links to d.py docs with
# :dpy_docs:`link text <site_name.html>`
extlinks = {"dpy_docs": (f"https://discordpy.readthedocs.io/en/v{dpy_version}/%s", None)}
# Doctest # Doctest
# If this string is non-empty, all blocks with ``>>>`` in them will be # If this string is non-empty, all blocks with ``>>>`` in them will be
# tested, not just the ones explicitly marked with ``.. doctest::`` # tested, not just the ones explicitly marked with ``.. doctest::``

View File

@ -7,7 +7,7 @@
Migrating Cogs to V3 Migrating Cogs to V3
==================== ====================
First, be sure to read `discord.py's migration guide <https://discordpy.readthedocs.io/en/v1.0.1/migrating.html>`_ First, be sure to read :dpy_docs:`discord.py's migration guide <migrating.html>`
as that covers all of the changes to discord.py that will affect the migration process as that covers all of the changes to discord.py that will affect the migration process
---------------- ----------------

View File

@ -314,5 +314,5 @@ Once done setting up the instance, run the following command to run Red:
It will walk through the initial setup, asking for your token and a prefix. It will walk through the initial setup, asking for your token and a prefix.
You can find out how to obtain a token with You can find out how to obtain a token with
`this guide <https://discordpy.readthedocs.io/en/v1.0.1/discord.html#creating-a-bot-account>`_, :dpy_docs:`this guide <discord.html#creating-a-bot-account>`,
section "Creating a Bot Account". section "Creating a Bot Account".

View File

@ -119,5 +119,5 @@ Once done setting up the instance, run the following command to run Red:
It will walk through the initial setup, asking for your token and a prefix. It will walk through the initial setup, asking for your token and a prefix.
You can find out how to obtain a token with You can find out how to obtain a token with
`this guide <https://discordpy.readthedocs.io/en/v1.0.1/discord.html#creating-a-bot-account>`_, :dpy_docs:`this guide <discord.html#creating-a-bot-account>`,
section "Creating a Bot Account". section "Creating a Bot Account".