Commit 947754fa authored by Jakub Ružička's avatar Jakub Ružička
Browse files

docs: fix file_link on Read the Docs

In RtD mkdocs build absolute path is supplied - make it relative when
that happens.
parent b9db09ed
Pipeline #80138 passed with stage
in 2 minutes and 19 seconds
...@@ -28,8 +28,14 @@ def define_env(env): ...@@ -28,8 +28,14 @@ def define_env(env):
@env.filter @env.filter
def file_link(path): def file_link(path):
fn = Path(path)
try:
# full path can be passed (i.e. on Read the Docs)
fn = Path(path).relative_to(BASE_PATH)
except ValueError:
pass
return "[{fn}]({url}{fn})".format( return "[{fn}]({url}{fn})".format(
fn=path.relative_to(BASE_PATH), fn=fn,
url=BASE_CODE_URL) url=BASE_CODE_URL)
@env.filter @env.filter
......
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