Docs: fix src links in extern repos

This commit is contained in:
Benjamin Canou 2018-07-09 12:20:56 +02:00
parent ea4e33b0e2
commit 9f4ff764a8

View File

@ -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], []