Make changelog easy to parse (#6711)

This commit is contained in:
Jakub Kuczys
2026-05-10 22:11:36 +02:00
committed by GitHub
parent cbd4643bd3
commit 7305f44f68
8 changed files with 968 additions and 138 deletions
+43
View File
@@ -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,
}