From 377e9c6866c829de3d980b98c6385a42619812dc Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@gmail.com> Date: Wed, 22 Jun 2016 12:00:44 +0100 Subject: [PATCH] Add link to source document in mantiddoc directives Stop warnings/errors coming out with no source information. --- docs/sphinxext/mantiddoc/directives/base.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/sphinxext/mantiddoc/directives/base.py b/docs/sphinxext/mantiddoc/directives/base.py index 135186d2d9b..ce943c66bff 100644 --- a/docs/sphinxext/mantiddoc/directives/base.py +++ b/docs/sphinxext/mantiddoc/directives/base.py @@ -73,9 +73,15 @@ class BaseDirective(Directive): """ Inserts the currently tracked rst lines into the state_machine """ - self.state_machine.insert_input(self.rst_lines, "") + self.state_machine.insert_input(self.rst_lines, self.source()) self.rst_lines = [] + def source(self): + """ + Returns the full path to the source document + """ + return self.state.document.settings.env.docname + def make_header(self, name, pagetitle=False): """ Makes a ReStructuredText title from the algorithm's name. @@ -207,5 +213,4 @@ class AlgorithmBaseDirective(BaseDirective): document. The expected name of the document is "AlgorithmName-v?", which is the name of the file with the extension removed """ - env = self.state.document.settings.env - (self.algm_name, self.algm_version) = algorithm_name_and_version(env.docname) + (self.algm_name, self.algm_version) = algorithm_name_and_version(self.source()) -- GitLab