diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/__init__.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..10dcf75288c50ec1edebb57d67a5508b42cb34f5 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/__init__.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/__init__.py @@ -0,0 +1,23 @@ +""" + Defines custom directives for Mantid documentation + + Each directive should be defined in a different module and have its own + setup(app) function. The setup function defined here is used to tie them + all together in the case where all directives are required, allowing + 'mantiddoc.directives' to be added to the Sphinx extensions configuration. +""" + +import algorithm, aliases, categories, properties, summary + +def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ + algorithm.setup(app) + aliases.setup(app) + categories.setup(app) + properties.setup(app) + summary.setup(app) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/algorithm.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/algorithm.py index 1f0de157bf665b1711927cf17b564ed64398c1cf..e07eb9ce853b1273f6521433496ab8866670f377 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/algorithm.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/algorithm.py @@ -1,6 +1,5 @@ from base import BaseDirective - class AlgorithmDirective(BaseDirective): """ @@ -56,5 +55,11 @@ class AlgorithmDirective(BaseDirective): def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ app.add_config_value('mantid_images', 'mantid_images', 'env') app.add_directive('algorithm', AlgorithmDirective) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/aliases.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/aliases.py index 55895f5ead343d553eb3ff6c2d248f2c8eb2ba5a..fed6897088221f7b53f51ce31ffd0a34c07c101e 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/aliases.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/aliases.py @@ -13,7 +13,7 @@ class AliasesDirective(BaseDirective): """ Called by Sphinx when the ..aliases:: directive is encountered. """ - title = self._make_header(__name__.title()) + title = self._make_header("Aliases") alias = self._get_alias(str(self.arguments[0])) return self._insert_rest(title + alias) @@ -29,4 +29,10 @@ class AliasesDirective(BaseDirective): def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ app.add_directive('aliases', AliasesDirective) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/categories.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/categories.py index f53b98a090bd9a42f6f5e1f9bfb22f3b7fd6cc91..0a4d147a5e43f84bcec9448335ea4668cc0f366a 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/categories.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/categories.py @@ -14,7 +14,7 @@ class CategoriesDirective(BaseDirective): Called by Sphinx when the ..categories:: directive is encountered. """ categories = self._get_categories(str(self.arguments[0])) - return self._insert_rest(categories) + return self._insert_rest("\n" + categories) def _get_categories(self, algorithm_name): """ @@ -38,4 +38,10 @@ class CategoriesDirective(BaseDirective): def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ app.add_directive('categories', CategoriesDirective) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py index 64d5de49c748924f1f366a6c30a1e0388c230a80..2e3b67a92e3cfe13943d5f24ddcc5efbec5a633a 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py @@ -14,7 +14,7 @@ class PropertiesDirective(BaseDirective): Called by Sphinx when the ..properties:: directive is encountered. """ alg_name = str(self.arguments[0]) - title = self._make_header(__name__.title()) + title = self._make_header("Properties") properties_table = self._populate_properties_table(alg_name) return self._insert_rest(title + properties_table) @@ -156,4 +156,10 @@ class PropertiesDirective(BaseDirective): def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ app.add_directive('properties', PropertiesDirective) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/summary.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/summary.py index c66fc706a064ddb3bff221dfbdc3ddb2317c3147..22a8f73c695d4c20a16aa85220b0fba9818699c8 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/summary.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/summary.py @@ -13,7 +13,7 @@ class SummaryDirective(BaseDirective): """ Called by Sphinx when the ..summary:: directive is encountered. """ - title = self._make_header(__name__.title()) + title = self._make_header("Summary") summary = self._get_summary(str(self.arguments[0])) return self._insert_rest(title + summary) @@ -29,4 +29,10 @@ class SummaryDirective(BaseDirective): def setup(app): + """ + Setup the directives when the extension is activated + + Args: + app: The main Sphinx application object + """ app.add_directive('summary', SummaryDirective)