diff --git a/doc/source/transform_github_links.py b/doc/source/transform_github_links.py index 695d51d..ad862dd 100644 --- a/doc/source/transform_github_links.py +++ b/doc/source/transform_github_links.py @@ -73,16 +73,17 @@ def transform_github_links(app, doctree, fromdocname): # Replace the suffix with the correct target format file ending, # but only if the link ends with both the correct source suffix # and refers to a local file. - if link.endswith(source_suffix): - # absolute paths are considered relative to repo - if link.startswith("/"): - basepath = "" - # relative paths are against the current doctree source path - else: - basepath = doc_dir - if os.path.exists(os.path.join(basepath, link)): - node['refuri'] = (link[:-len(source_suffix)] + target_format + - anchor) + for src_suffix in source_suffix: + if link.endswith(src_suffix): + # absolute paths are considered relative to repo + if link.startswith("/"): + basepath = "" + # relative paths are against the current doctree source path + else: + basepath = doc_dir + if os.path.exists(os.path.join(basepath, link)): + node['refuri'] = (link[:-len(source_suffix)] + target_format + + anchor) def setup(app): diff --git a/test-requirements.txt b/test-requirements.txt index 62e3253..e2cbaaf 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ hacking>=0.11.0,<0.12 # Apache-2.0 loremipsum mock!=1.1.1,<=1.3.0 -Sphinx>=1.1.2,<1.2 +sphinx>=1.5.1 # BSD discover coverage>=3.6 # Apache-2.0 fixtures>=0.3.14