Skip to content

Commit

Permalink
fix: Only add external version warning nodes on documents (#114)
Browse files Browse the repository at this point in the history

Co-authored-by: Santos Gallegos <stsewd@proton.me>
  • Loading branch information
elenakrittik and stsewd authored Sep 14, 2022
1 parent 673fbb0 commit 9e75356
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions readthedocs_ext/external_version_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ def process_external_version_warning_banner(app, doctree, fromdocname):
If the version type is external this will show a warning banner
at the top of each page of the documentation.
"""
# Sphinx itself always emits this with a document node,
# but extensions can also call `resolve_references` with other types
# of nodes, we don't want to inject the banner in those.
# Details:
# - https://github.com/readthedocs/readthedocs-sphinx-ext/issues/113
# - https://github.com/readthedocs/readthedocs-sphinx-ext/pull/114
if not isinstance(doctree, nodes.document):
return

is_gitlab = app.config.html_context.get('display_gitlab')
name = 'merge request' if is_gitlab else 'pull request'

Expand Down

0 comments on commit 9e75356

Please sign in to comment.