Skip to content

Commit

Permalink
Add switch to toggle 'in dev' compatibility warning
Browse files Browse the repository at this point in the history
Follow-up to godotengine#4052.
  • Loading branch information
akien-mga committed Sep 22, 2020
1 parent 19c9e9f commit 46ceaab
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
# The full version, including alpha/beta/rc tags
release = version

# Set this True when the `latest` branch is significantly incompatible with the
# current `stable` branch, which can lead to confusion for users that land on
# `latest` instead of `stable`.
in_dev = True

# Parse Sphinx tags passed from RTD via environment
env_tags = os.getenv("SPHINX_TAGS")
if env_tags is not None:
Expand Down Expand Up @@ -233,17 +238,18 @@ def godot_get_image_filename_for_language(filename, env):
# Read the Docs adds a note at the top of the page when reading documentation
# for an old stable version, but not when reading the latest unstable version.
# We want to add a warning note as the `latest` documentation may not always
# apply to Godot 3.2.x.
rst_prolog = """
# apply to the current `stable` version.
if in_dev:
rst_prolog = """
.. attention::
You are reading the ``latest`` (unstable) version of this documentation,
which may document features not available or compatible with Godot 3.2.x.
See `this page <https://docs.godotengine.org/{locale}/stable/>`__
for the stable version of this documentation.
""".format(
locale=language,
)
locale=language,
)

# Couldn't find a way to retrieve variables nor do advanced string
# concat from reST, so had to hardcode this in the "epilog" added to
Expand Down

0 comments on commit 46ceaab

Please sign in to comment.