mirror of
https://github.com/polybar/polybar.git
synced 2024-11-11 13:50:56 -05:00
fix(doc): %s in extlinks caption before sphinx 4.0
There is no way to support extlinks with a custom caption in both sphinx < 4 and >= 4 at the same time without implementing different behavior per version.
This commit is contained in:
parent
89ca0255f1
commit
7bc673b8f2
1 changed files with 16 additions and 5 deletions
21
doc/conf.py
21
doc/conf.py
|
@ -36,6 +36,9 @@ def get_version(root_path):
|
||||||
|
|
||||||
raise RuntimeError("No version found in {}".format(path))
|
raise RuntimeError("No version found in {}".format(path))
|
||||||
|
|
||||||
|
|
||||||
|
sphinx_version = packaging.version.parse(sphinx.__version__)
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,10 +120,18 @@ highlight_language = 'none'
|
||||||
smartquotes = False
|
smartquotes = False
|
||||||
|
|
||||||
# Quickly link to issues or PRs using :issue:`...` or :pull:`...`
|
# Quickly link to issues or PRs using :issue:`...` or :pull:`...`
|
||||||
extlinks = {
|
if sphinx_version >= packaging.version.parse("4.0.0"):
|
||||||
"issue": ("https://github.com/polybar/polybar/issues/%s", "#"),
|
extlinks = {
|
||||||
"pull": ("https://github.com/polybar/polybar/pull/%s", "PR #"),
|
"issue": ("https://github.com/polybar/polybar/issues/%s", "#%s"),
|
||||||
}
|
"pull": ("https://github.com/polybar/polybar/pull/%s", "PR #%s"),
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# Versions before 4.0 (e.g. on readthedocs) do not support %s in the
|
||||||
|
# caption and simply append the value
|
||||||
|
extlinks = {
|
||||||
|
"issue": ("https://github.com/polybar/polybar/issues/%s", "#"),
|
||||||
|
"pull": ("https://github.com/polybar/polybar/pull/%s", "PR #"),
|
||||||
|
}
|
||||||
|
|
||||||
extlinks_detect_hardcoded_links = True
|
extlinks_detect_hardcoded_links = True
|
||||||
|
|
||||||
|
@ -302,7 +313,7 @@ def setup(app):
|
||||||
# built from master, documentation built for proper releases should not even
|
# built from master, documentation built for proper releases should not even
|
||||||
# mention unreleased changes. Because of that it's not that important that this
|
# mention unreleased changes. Because of that it's not that important that this
|
||||||
# is added to local builds.
|
# is added to local builds.
|
||||||
if packaging.version.parse(sphinx.__version__) >= packaging.version.parse("1.8.5"):
|
if sphinx_version >= packaging.version.parse("1.8.5"):
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
from docutils.nodes import Node
|
from docutils.nodes import Node
|
||||||
|
|
Loading…
Reference in a new issue