Commit 9f4ff764 authored by Benjamin Canou's avatar Benjamin Canou

Docs: fix src links in extern repos

parent ea4e33b0
......@@ -26,10 +26,9 @@ def package_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
else:
lib = text
src = find_dot_opam(lib)
branch = os.environ.get('CI_COMMIT_REF_NAME')
if not branch:
branch = 'master'
src_url = "https://gitlab.com/tezos/tezos/tree/" + branch + "/" + src
branch = os.environ.get('CI_COMMIT_REF_NAME', 'master')
project_url = os.environ.get('CI_PROJECT_URL', 'https://gitlab.com/tezos/tezos')
src_url = project_url + "/tree/" + branch + "/" + src
if os.path.isdir('_build/api/odoc/'+lib):
if os.path.isdir(os.path.join('_build','api','odoc',lib,lib.replace('-','_').capitalize())):
lib = lib + '/' + lib.replace('-','_').capitalize()
......@@ -71,9 +70,8 @@ def src_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
else:
src = text
text = text
branch = os.environ.get('CI_COMMIT_REF_NAME')
if not branch:
branch = 'master'
url = "https://gitlab.com/tezos/tezos/tree/" + branch + "/" + src
branch = os.environ.get('CI_COMMIT_REF_NAME', 'master')
project_url = os.environ.get('CI_PROJECT_URL', 'https://gitlab.com/tezos/tezos')
url = project_url + "/tree/" + branch + "/" + src
node = nodes.reference(rawtext, text, refuri=url, **options)
return [node], []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment