Skip to content

Commit

Permalink
so does it fucking work now?
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Dec 31, 2022
1 parent a9eb03c commit 8d2fe0c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions releases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,11 @@ def visit_bullet_list(self, node):
# one being visited doesn't appear to apply.
if self.found_changelog:
return
# The bullet list's parent should be a 'section' node with 'ids'
# attribute derived from the original document name (even in singlehtml
# mode). If we don't see this, move on.
print(f"docnames: {self.docnames!r}", file=sys.stderr)
print(f"node.parent.attributes.ids: {node.parent.attributes['ids']!r}", file=sys.stderr)
if not set(self.docnames).intersection(node.parent.attributes["ids"]):
# Also short circuit if we're in singlepage mode and the node's parent
# doesn't seem to be named after an expected changelog docname. In this
# mode, this is the earliest we can actually tell whether a given
# bullet list is or is not "the changelog".
if self.app._is_singlepage and node.parent.attributes.get('docname', None) not in self.docnames:
return
# At this point, we can safely assume the node we're visiting is the
# right one to mutate.
Expand All @@ -617,10 +616,9 @@ def generate_changelog(app, doctree, docname):
# Ensure we still work mostly-correctly in singlehtml builder situations
# (must use name substring test as RTD's singlehtml builder doesn't
# actually inherit from Sphinx's own!)
is_singlepage = "singlehtml" in app.builder.name
changelog_names = ["index"] if is_singlepage else desired_docnames
print(f"is_singlepage: {is_singlepage!r}", file=sys.stderr)
print(f"changelog_names: {changelog_names!r}", file=sys.stderr)
# NOTE: monkeypatching onto the builder for easier reuse deeper in stack
app._is_singlepage = "singlehtml" in app.builder.name
changelog_names = ["index"] if app._is_singlepage else desired_docnames
if docname not in changelog_names:
return

Expand Down

0 comments on commit 8d2fe0c

Please sign in to comment.