mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2026-05-22 06:54:51 -04:00
Make changelog easy to parse (#6711)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from docutils import nodes
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
|
||||
|
||||
class ChangelogContributors(SphinxDirective):
|
||||
has_content = True
|
||||
|
||||
def run(self) -> List[nodes.Node]:
|
||||
contributors = [contributor for line in self.content for contributor in line.split()]
|
||||
|
||||
comment_value = " ".join(contributors)
|
||||
line_nodes = []
|
||||
for contributor in contributors:
|
||||
if line_nodes:
|
||||
line_nodes.append(nodes.Text(", "))
|
||||
line_nodes.append(
|
||||
nodes.reference(
|
||||
contributor,
|
||||
f"@{contributor}",
|
||||
internal=False,
|
||||
refuri=f"https://github.com/sponsors/{contributor}",
|
||||
)
|
||||
)
|
||||
|
||||
node = nodes.line_block(
|
||||
"",
|
||||
nodes.comment("", f"RED-CHANGELOG-CONTRIBUTORS: {comment_value}"),
|
||||
nodes.line("", "Thanks to all these amazing people who contributed to this release:"),
|
||||
nodes.line("", "", *line_nodes),
|
||||
)
|
||||
return [node]
|
||||
|
||||
|
||||
def setup(app: Sphinx) -> Dict[str, Any]:
|
||||
app.add_directive("changelog-contributors", ChangelogContributors)
|
||||
return {
|
||||
"version": "1.0",
|
||||
"parallel_read_safe": True,
|
||||
"parallel_write_safe": True,
|
||||
}
|
||||
@@ -44,7 +44,9 @@ extensions = [
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.doctest",
|
||||
"sphinxcontrib_trio",
|
||||
"sphinx_markdown_builder",
|
||||
"sphinx-prompt",
|
||||
"changelog_contributors",
|
||||
"deprecated_removed",
|
||||
"prompt_builder",
|
||||
]
|
||||
@@ -230,6 +232,14 @@ linkcheck_ignore = [r"https://java.com*", r"https://chocolatey.org*"]
|
||||
linkcheck_retries = 3
|
||||
|
||||
|
||||
# -- Options for markdown builder ----------------------------------------
|
||||
|
||||
markdown_http_base = os.environ.get(
|
||||
"READTHEDOCS_CANONICAL_URL", "https://docs.discord.red/en/stable"
|
||||
)
|
||||
markdown_uri_doc_suffix = ".html"
|
||||
|
||||
|
||||
# -- Options for extensions -----------------------------------------------
|
||||
|
||||
if dpy_version_info.releaselevel == "final":
|
||||
|
||||
Reference in New Issue
Block a user