From 2b2920c4bba0b6c377c2021ad6c362ffed69d591 Mon Sep 17 00:00:00 2001 From: Pete Peterson <petersonpf@ornl.gov> Date: Tue, 6 Oct 2015 11:22:54 -0400 Subject: [PATCH] Linking to github source should work --- docs/sphinxext/mantiddoc/directives/sourcelink.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/sphinxext/mantiddoc/directives/sourcelink.py b/docs/sphinxext/mantiddoc/directives/sourcelink.py index 1fc3002fb9e..a8f867f1582 100644 --- a/docs/sphinxext/mantiddoc/directives/sourcelink.py +++ b/docs/sphinxext/mantiddoc/directives/sourcelink.py @@ -214,16 +214,14 @@ class SourceLinkDirective(AlgorithmBaseDirective): #example url https://github.com/mantidproject/mantid/blob/master/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/MergeRuns.h url = file_path + # remove the directory path + url = url.replace(self.get_mantid_directory(), "") #harmonize slashes url = url.replace("\\","/") - #remove everything before Code - index = url.find("Code") - if index != -1: - url = url[index:] - else: - raise SourceLinkError ("Could not find the 'Code' directory in " + url) #prepend the github part - url = "https://github.com/mantidproject/mantid/blob/" + mantid.kernel.revision_full() + "/" + url + if not url.startswith("/"): + url = "/"+url + url = "https://github.com/mantidproject/mantid/blob/" + mantid.kernel.revision_full() + url return url def setup(app): -- GitLab