From c287e9900cceed9a728bc5125343fd35b9898178 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Thu, 9 Dec 2021 20:01:03 +0400 Subject: Add InterSphinx Extension Adds the intersphinx extension to link discord.py and python docs to the autogenerated references. --- docs/changelog.rst | 1 + docs/conf.py | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'docs') diff --git a/docs/changelog.rst b/docs/changelog.rst index 4954b59c..58b8e558 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,7 @@ Changelog ========= +- :support:`3` Added intersphinx to docs. - :support:`2` Autogenerated docs. - :feature:`2` Regex utility. - :support:`1` Core package, poetry, and linting CI. diff --git a/docs/conf.py b/docs/conf.py index 4ab831d3..864168f6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ add_module_names = False # ones. extensions = [ "sphinx.ext.extlinks", + "sphinx.ext.intersphinx", "sphinx.ext.autodoc", "sphinx.ext.todo", "sphinx.ext.napoleon", @@ -169,6 +170,13 @@ extlinks = { } +# -- Options for intersphinx extension --------------------------------------- +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "discord": ("https://discordpy.readthedocs.io/en/master/", None), +} + + # -- Options for the linkcode extension -------------------------------------- def linkcode_resolve(domain: str, info: dict[str, str]) -> typing.Optional[str]: """ -- cgit v1.2.3 From 1b098fc6dc0bbd6b5715f63b6f68e876cf1b45ed Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Thu, 9 Dec 2021 20:52:54 +0400 Subject: Modify Autodoc Formatting Changes the style of the reformatted autodoc files to look nicer with submodules. --- docs/conf.py | 34 ++++++++++++++++------------------ pyproject.toml | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 864168f6..142ceb41 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -99,31 +99,29 @@ def __cleanup() -> None: # We only have one module, so this is redundant # Remove it and flatten out the tree file.unlink() + continue - elif file.name == "botcore.rst": - # We want to bring the submodule name to the top, and remove anything that's not a submodule - result = "" - for line in file.read_text(encoding="utf-8").splitlines(keepends=True): - if ".." not in line and result == "": - # We have not reached the first submodule, this is all filler - continue - elif "Module contents" in line: - # We have parsed all the submodules, so let's skip the redudant module name - break - result += line + elif file.name in ("botcore.rst", "botcore.exts.rst"): + content = file.read_text(encoding="utf-8").splitlines(keepends=True) + + # Rename the extension to be less wordy + # Example: botcore.exts -> Botcore Exts + title = content[0].split()[0].strip().replace("botcore.", "").replace(".", " ").title() + title = f"{title}\n{'=' * len(title)}\n\n" + content[0:2] = title - result = "Botcore\n=======\n\n" + result - file.write_text(result, encoding="utf-8") + file.write_text("".join(content), encoding="utf-8") else: # Clean up the submodule name so it's just the name without the top level module name # example: `botcore.regex module` -> `regex` - lines = file.read_text(encoding="utf-8").splitlines() - lines[0] = lines[0].replace("botcore.", "").replace("module", "").strip() + lines = file.read_text(encoding="utf-8").splitlines(keepends=True) + lines[0] = lines[0].replace("module", "").strip().split(".")[-1] + "\n" + file.write_text("".join(lines)) - # Take the opportunity to configure autodoc - lines = "\n".join(lines).replace("undoc-members", "special-members") - file.write_text(lines, encoding="utf-8") + # Take the opportunity to configure autodoc + content = file.read_text(encoding="utf-8").replace("undoc-members", "special-members") + file.write_text(content, encoding="utf-8") __cleanup() diff --git a/pyproject.toml b/pyproject.toml index c0a57862..59ce321b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ furo = "^2021.11.23" [tool.taskipy.tasks] lint = "pre-commit run --all-files" precommit = "pre-commit install" -apidoc = "sphinx-apidoc -o docs/output botcore -fe" +apidoc = "sphinx-apidoc -o docs/output botcore -feM" builddoc = "sphinx-build -nW -j auto -b html docs docs/build" docs = "task apidoc && task builddoc" -- cgit v1.2.3 From b61c1e6a5739e5aabbea1dc8cd70297bb666827b Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Mon, 21 Feb 2022 12:58:40 +0000 Subject: Update how we auto-generate docs --- docs/conf.py | 118 ++++++++-------------------------------------------------- docs/utils.py | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 103 deletions(-) create mode 100644 docs/utils.py (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 142ceb41..e2801e2c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,16 +1,14 @@ # Configuration file for the Sphinx documentation builder. # https://www.sphinx-doc.org/en/master/usage/configuration.html -import ast -import importlib -import inspect +import functools import sys -import typing from pathlib import Path import git import tomli -from sphinx.application import Sphinx + +from docs import utils # -- Project information ----------------------------------------------------- @@ -90,43 +88,6 @@ html_js_files = [ ] -# -- Autodoc cleanup --------------------------------------------------------- -# Clean up the output generated by autodoc to produce a nicer documentation tree -# This is kept in a function to avoid polluting the namespace -def __cleanup() -> None: - for file in (PROJECT_ROOT / "docs" / "output").iterdir(): - if file.name == "modules.rst": - # We only have one module, so this is redundant - # Remove it and flatten out the tree - file.unlink() - continue - - elif file.name in ("botcore.rst", "botcore.exts.rst"): - content = file.read_text(encoding="utf-8").splitlines(keepends=True) - - # Rename the extension to be less wordy - # Example: botcore.exts -> Botcore Exts - title = content[0].split()[0].strip().replace("botcore.", "").replace(".", " ").title() - title = f"{title}\n{'=' * len(title)}\n\n" - content[0:2] = title - - file.write_text("".join(content), encoding="utf-8") - - else: - # Clean up the submodule name so it's just the name without the top level module name - # example: `botcore.regex module` -> `regex` - lines = file.read_text(encoding="utf-8").splitlines(keepends=True) - lines[0] = lines[0].replace("module", "").strip().split(".")[-1] + "\n" - file.write_text("".join(lines)) - - # Take the opportunity to configure autodoc - content = file.read_text(encoding="utf-8").replace("undoc-members", "special-members") - file.write_text(content, encoding="utf-8") - - -__cleanup() - - def skip(*args) -> bool: """Things that should be skipped by the autodoc generation.""" name = args[2] @@ -139,11 +100,6 @@ def skip(*args) -> bool: return would_skip -def setup(app: Sphinx) -> None: - """Add extra hook-based autodoc configuration.""" - app.connect("autodoc-skip-member", skip) - - # -- Extension configuration ------------------------------------------------- # -- Options for todo extension ---------------------------------------------- @@ -175,60 +131,16 @@ intersphinx_mapping = { } +# -- Options for the autodoc extension --------------------------------------- +utils.cleanup() +autodoc_default_options = { + "members": True, + "special-members": True, + "show-inheritance": True, + "imported-members": False, + "exclude-members": "__weakref__" +} + + # -- Options for the linkcode extension -------------------------------------- -def linkcode_resolve(domain: str, info: dict[str, str]) -> typing.Optional[str]: - """ - Function called by linkcode to get the URL for a given resource. - - See for more details: - https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#confval-linkcode_resolve - """ - if domain != "py": - raise Exception("Unknown domain passed to linkcode function.") - - symbol_name = info["fullname"] - - module = importlib.import_module(info["module"]) - - symbol = [module] - for name in symbol_name.split("."): - symbol.append(getattr(symbol[-1], name)) - symbol_name = name - - try: - lines, start = inspect.getsourcelines(symbol[-1]) - end = start + len(lines) - except TypeError: - # Find variables by parsing the ast - source = ast.parse(inspect.getsource(symbol[-2])) - while isinstance(source.body[0], ast.ClassDef): - source = source.body[0] - - for ast_obj in source.body: - if isinstance(ast_obj, ast.Assign): - names = [] - for target in ast_obj.targets: - if isinstance(target, ast.Tuple): - names.extend([name.id for name in target.elts]) - else: - names.append(target.id) - - if symbol_name in names: - start, end = ast_obj.lineno, ast_obj.end_lineno - break - else: - raise Exception(f"Could not find symbol `{symbol_name}` in {module.__name__}.") - - _, offset = inspect.getsourcelines(symbol[-2]) - if offset != 0: - offset -= 1 - start += offset - end += offset - - file = Path(inspect.getfile(module)).relative_to(PROJECT_ROOT).as_posix() - - url = f"{SOURCE_FILE_LINK}/{file}#L{start}" - if end != start: - url += f"-L{end}" - - return url +linkcode_resolve = functools.partial(utils.linkcode_resolve, SOURCE_FILE_LINK) diff --git a/docs/utils.py b/docs/utils.py new file mode 100644 index 00000000..8bc69ccd --- /dev/null +++ b/docs/utils.py @@ -0,0 +1,117 @@ +"""Utilities used in generating docs.""" + +import ast +import importlib +import inspect +import typing +from pathlib import Path + +PROJECT_ROOT = Path(__file__).parent.parent + + +def linkcode_resolve(source_url: str, domain: str, info: dict[str, str]) -> typing.Optional[str]: + """ + Function called by linkcode to get the URL for a given resource. + + See for more details: + https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#confval-linkcode_resolve + """ + if domain != "py": + raise Exception("Unknown domain passed to linkcode function.") + + symbol_name = info["fullname"] + + module = importlib.import_module(info["module"]) + + symbol = [module] + for name in symbol_name.split("."): + symbol.append(getattr(symbol[-1], name)) + symbol_name = name + + try: + lines, start = inspect.getsourcelines(symbol[-1]) + end = start + len(lines) + except TypeError: + # Find variables by parsing the ast + source = ast.parse(inspect.getsource(symbol[-2])) + while isinstance(source.body[0], ast.ClassDef): + source = source.body[0] + + for ast_obj in source.body: + if isinstance(ast_obj, ast.Assign): + names = [] + for target in ast_obj.targets: + if isinstance(target, ast.Tuple): + names.extend([name.id for name in target.elts]) + else: + names.append(target.id) + + if symbol_name in names: + start, end = ast_obj.lineno, ast_obj.end_lineno + break + else: + raise Exception(f"Could not find symbol `{symbol_name}` in {module.__name__}.") + + _, offset = inspect.getsourcelines(symbol[-2]) + if offset != 0: + offset -= 1 + start += offset + end += offset + + file = Path(inspect.getfile(module)).relative_to(PROJECT_ROOT).as_posix() + + url = f"{source_url}/{file}#L{start}" + if end != start: + url += f"-L{end}" + + return url + + +def cleanup() -> None: + """Remove unneeded autogenerated doc files, and clean up others.""" + included = __get_included() + + for file in (PROJECT_ROOT / "docs" / "output").iterdir(): + if file.name in ("botcore.rst", "botcore.exts.rst") and file.name in included: + content = file.read_text(encoding="utf-8").splitlines(keepends=True) + + # Rename the extension to be less wordy + # Example: botcore.exts -> Botcore Exts + title = content[0].split()[0].strip().replace("botcore.", "").replace(".", " ").title() + title = f"{title}\n{'=' * len(title)}\n\n" + content[0:2] = title + + file.write_text("".join(content), encoding="utf-8") + + elif file.name in included: + # Clean up the submodule name so it's just the name without the top level module name + # example: `botcore.regex module` -> `regex` + lines = file.read_text(encoding="utf-8").splitlines(keepends=True) + lines[0] = lines[0].replace("module", "").strip().split(".")[-1] + "\n" + file.write_text("".join(lines)) + + else: + # These are files that have not been explicitly included in the docs via __all__ + print("Deleted file", file.name) + file.unlink() + continue + + # Take the opportunity to configure autodoc + content = file.read_text(encoding="utf-8").replace("undoc-members", "special-members") + file.write_text(content, encoding="utf-8") + + +def __get_included() -> set[str]: + """Get a list of files that should be included in the final build.""" + + def get_all_from_module(module_name: str) -> set[str]: + module = importlib.import_module(module_name) + _modules = {module.__name__ + ".rst"} + + if hasattr(module, "__all__"): + for sub_module in module.__all__: + _modules.update(get_all_from_module(sub_module)) + + return _modules + + return get_all_from_module("botcore") -- cgit v1.2.3 From fef4c75210fbf812279cc73457abe42bbe8fd983 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Mon, 21 Feb 2022 20:28:12 +0400 Subject: Revert Breaking Doc Changes A previous commit tried to utilize the default autodoc option configuration to make the doc generation more streamlined and organized, but they seem to not work well. --- docs/conf.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index e2801e2c..23feab31 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,6 +7,7 @@ from pathlib import Path import git import tomli +from sphinx.application import Sphinx from docs import utils @@ -87,6 +88,8 @@ html_js_files = [ "changelog.js", ] +utils.cleanup() + def skip(*args) -> bool: """Things that should be skipped by the autodoc generation.""" @@ -100,6 +103,11 @@ def skip(*args) -> bool: return would_skip +def setup(app: Sphinx) -> None: + """Add extra hook-based autodoc configuration.""" + app.connect("autodoc-skip-member", skip) + + # -- Extension configuration ------------------------------------------------- # -- Options for todo extension ---------------------------------------------- @@ -131,16 +139,5 @@ intersphinx_mapping = { } -# -- Options for the autodoc extension --------------------------------------- -utils.cleanup() -autodoc_default_options = { - "members": True, - "special-members": True, - "show-inheritance": True, - "imported-members": False, - "exclude-members": "__weakref__" -} - - # -- Options for the linkcode extension -------------------------------------- linkcode_resolve = functools.partial(utils.linkcode_resolve, SOURCE_FILE_LINK) -- cgit v1.2.3 From 146c4873895923cd3e29acd6db6304c6200db0c6 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Mon, 21 Feb 2022 20:48:45 +0400 Subject: Explicitly Specify Path In Docs Build Sphinx build in GitHub actions was not adding the path of the file being run, or the working directory, or anything else to sys.path, which broke imports. --- docs/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 23feab31..efc555c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,6 +2,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html import functools +import os.path import sys from pathlib import Path @@ -9,7 +10,10 @@ import git import tomli from sphinx.application import Sphinx -from docs import utils +# Handle the path not being set correctly in actions. +sys.path.insert(0, os.path.abspath('..')) + +from docs import utils # noqa: E402 # -- Project information ----------------------------------------------------- -- cgit v1.2.3 From 8e66c33790e8f22aebdf1289c4707d5d56264271 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 21 Feb 2022 17:20:31 +0000 Subject: Remove releases package used to autogenerate changelog --- docs/changelog.rst | 15 --------------- docs/conf.py | 5 ----- docs/index.rst | 5 ----- poetry.lock | 30 +----------------------------- pyproject.toml | 1 - 5 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 docs/changelog.rst (limited to 'docs') diff --git a/docs/changelog.rst b/docs/changelog.rst deleted file mode 100644 index 25d01756..00000000 --- a/docs/changelog.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. See docs for details on formatting your entries - https://releases.readthedocs.io/en/latest/concepts.html - - -Changelog -========= -- :release:`1.2.1 <22nd February 2022>` -- :support:`3` Added intersphinx to docs. -- :release:`1.2.0 <9th January 2022>` -- :feature:`12` Code block detection regex -- :release:`1.1.0 <2nd December 2021>` -- :support:`2` Autogenerated docs. -- :feature:`2` Regex utility. -- :release:`1.0.0 <17th November 2021>` -- :support:`1` Core package, poetry, and linting CI. diff --git a/docs/conf.py b/docs/conf.py index efc555c1..0f0167ad 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -46,7 +46,6 @@ extensions = [ "sphinx.ext.todo", "sphinx.ext.napoleon", "sphinx_autodoc_typehints", - "releases", "sphinx.ext.linkcode", "sphinx.ext.githubpages", ] @@ -126,10 +125,6 @@ napoleon_numpy_docstring = False napoleon_attr_annotations = True -# -- Options for releases extension ------------------------------------------ -releases_github_path = REPO_LINK.removeprefix("https://github.com/") - - # -- Options for extlinks extension ------------------------------------------ extlinks = { "repo-file": (f"{REPO_LINK}/blob/main/%s", "repo-file %s") diff --git a/docs/index.rst b/docs/index.rst index e7c25ef1..02dd84bb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,11 +13,6 @@ Reference output/botcore -.. toctree:: - :caption: Other: - - changelog - Extras ================== diff --git a/poetry.lock b/poetry.lock index 9848e951..2a4b7e31 100644 --- a/poetry.lock +++ b/poetry.lock @@ -671,18 +671,6 @@ category = "dev" optional = false python-versions = ">=3.6" -[[package]] -name = "releases" -version = "1.6.3" -description = "A Sphinx extension for changelog manipulation" -category = "dev" -optional = false -python-versions = "*" - -[package.dependencies] -semantic-version = "<2.7" -sphinx = ">=1.3" - [[package]] name = "requests" version = "2.27.1" @@ -701,14 +689,6 @@ urllib3 = ">=1.21.1,<1.27" socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] -[[package]] -name = "semantic-version" -version = "2.6.0" -description = "A library implementing the 'SemVer' scheme." -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "six" version = "1.16.0" @@ -955,7 +935,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "3.9.*" -content-hash = "fd428068f017418a45a174c2a60af575aad76dfa2707b72010e891753e89cf91" +content-hash = "38723e13b555129a52187dfaecf5cec88572d4a0eed1f5ff7350baccc39ecf70" [metadata.files] aiohttp = [ @@ -1424,18 +1404,10 @@ pyyaml = [ {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, ] -releases = [ - {file = "releases-1.6.3-py2.py3-none-any.whl", hash = "sha256:cb3435ba372a6807433800fbe473760cfa781171513f670f3c4b76983ac80f18"}, - {file = "releases-1.6.3.tar.gz", hash = "sha256:555ae4c97a671a420281c1c782e9236be25157b449fdf20b4c4b293fe93db2f1"}, -] requests = [ {file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"}, {file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"}, ] -semantic-version = [ - {file = "semantic_version-2.6.0-py3-none-any.whl", hash = "sha256:2d06ab7372034bcb8b54f2205370f4aa0643c133b7e6dbd129c5200b83ab394b"}, - {file = "semantic_version-2.6.0.tar.gz", hash = "sha256:2a4328680073e9b243667b201119772aefc5fc63ae32398d6afafff07c4f54c0"}, -] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, diff --git a/pyproject.toml b/pyproject.toml index 37983b82..e7f98819 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ Sphinx = "4.4.0" tomli = "2.0.0" GitPython = "3.1.26" sphinx-autodoc-typehints = "1.17.0" -releases = "1.6.3" furo = "2022.1.2" -- cgit v1.2.3 From b3c4cf3c81cea56638beb002ecba96707fb5f96b Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 21 Feb 2022 17:20:53 +0000 Subject: Add markdown powered changelog --- CHANGELOG.md | 22 ++++++++++++++++++++++ docs/_static/changelog.css | 11 ----------- docs/_static/changelog.js | 37 ------------------------------------- docs/conf.py | 5 ----- docs/index.rst | 1 + 5 files changed, 23 insertions(+), 53 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 docs/_static/changelog.css delete mode 100644 docs/_static/changelog.js (limited to 'docs') diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..456ecb2c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +## 1.3.0 22nd February 2022 +- Feature: Port many common utilities from our bots + - caching + - channel + - extensions + - loggers + - members + - scheduling +- Support: Added intersphinx to docs. + +## 1.2.0 9th January 2022 +- Feature: Code block detection regex + +## 1.1.0 2nd December 2021 +- Support: Autogenerated docs. +- Feature: Regex utility. + + +## 1.0.0 17th November 2021 +- Support: Core package, poetry, and linting CI. diff --git a/docs/_static/changelog.css b/docs/_static/changelog.css deleted file mode 100644 index 343792a1..00000000 --- a/docs/_static/changelog.css +++ /dev/null @@ -1,11 +0,0 @@ -[data-theme='dark'] #changelog .dark, -[data-theme='light'] #changelog .light, -[data-theme='auto'] #changelog .light { - display: inline; -} - -[data-theme='dark'] #changelog .light, -[data-theme='light'] #changelog .dark, -[data-theme='auto'] #changelog .dark { - display: none; -} diff --git a/docs/_static/changelog.js b/docs/_static/changelog.js deleted file mode 100644 index f72d025c..00000000 --- a/docs/_static/changelog.js +++ /dev/null @@ -1,37 +0,0 @@ -/** Update the changelog colors in dark mode */ - -const changelog = document.getElementById("changelog"); - -function updateEntryColor(entry) { - const line = entry.lastChild; - const lightColorSpan = line.childNodes.item(1); - const darkColorSpan = lightColorSpan.cloneNode(true); - - line.insertBefore(darkColorSpan, lightColorSpan); - - lightColorSpan.classList.add("light"); - darkColorSpan.classList.add("dark"); - - let color; - switch (darkColorSpan.textContent) { - case "Feature": - color = "#5BF38E"; - break; - case "Support": - color = "#55A5E7"; - break; - case "Bug": - color = "#E14F4F"; - break; - default: - color = null; - } - - darkColorSpan.style["color"] = color; -} - -if (changelog !== null) { - for (let collection of changelog.getElementsByClassName("simple")) { - Array.from(collection.children).forEach(updateEntryColor); - } -} diff --git a/docs/conf.py b/docs/conf.py index 0f0167ad..476a4d36 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -83,14 +83,9 @@ html_logo = "https://raw.githubusercontent.com/python-discord/branding/main/logo html_favicon = html_logo html_css_files = [ - "changelog.css", "logo.css", ] -html_js_files = [ - "changelog.js", -] - utils.cleanup() diff --git a/docs/index.rst b/docs/index.rst index 02dd84bb..81975f35 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,3 +20,4 @@ Extras * :ref:`genindex` * :ref:`search` * :repo-file:`Information ` +* :repo-file:`Changelog ` -- cgit v1.2.3 From aed1a762d97863b136e51e5d3a95d1333492dc72 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 24 Feb 2022 16:20:07 +0000 Subject: Include utils package in doc cleanup funciton --- docs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/utils.py b/docs/utils.py index 8bc69ccd..6afbeec0 100644 --- a/docs/utils.py +++ b/docs/utils.py @@ -72,7 +72,7 @@ def cleanup() -> None: included = __get_included() for file in (PROJECT_ROOT / "docs" / "output").iterdir(): - if file.name in ("botcore.rst", "botcore.exts.rst") and file.name in included: + if file.name in ("botcore.rst", "botcore.exts.rst", "botcore.utils.rst") and file.name in included: content = file.read_text(encoding="utf-8").splitlines(keepends=True) # Rename the extension to be less wordy -- cgit v1.2.3 From 222025fdaab4cc66427590dc053730a09a5af24e Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 24 Feb 2022 17:44:07 +0000 Subject: Update GHA Docs Build To Match Pyproject Updates the command in GH actions to match the command in pyproject to generate the correct output. Kaizens a small fix in clean up. --- .github/workflows/docs.yaml | 2 +- docs/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 8018d63c..a01ea58f 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -31,7 +31,7 @@ jobs: - run: pip install six - name: Generate AutoDoc References - run: sphinx-apidoc -o docs/output botcore -fe + run: sphinx-apidoc -o docs/output botcore -feM - name: Generate HTML Site run: sphinx-build -nW -j auto -b html docs docs/build diff --git a/docs/utils.py b/docs/utils.py index 6afbeec0..76b3e098 100644 --- a/docs/utils.py +++ b/docs/utils.py @@ -79,7 +79,7 @@ def cleanup() -> None: # Example: botcore.exts -> Botcore Exts title = content[0].split()[0].strip().replace("botcore.", "").replace(".", " ").title() title = f"{title}\n{'=' * len(title)}\n\n" - content[0:2] = title + content = title, *content[3:] file.write_text("".join(content), encoding="utf-8") -- cgit v1.2.3