From 28995a15eea34edafcb15c996fd27072c7822189 Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@stfc.ac.uk> Date: Mon, 2 Jun 2014 18:21:36 +0100 Subject: [PATCH] Skip properties directive if there are no properties Refs #9562 --- .../sphinxext/mantiddoc/directives/properties.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py index 0f6177b0ed2..f8219d68190 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py @@ -13,18 +13,19 @@ class PropertiesDirective(BaseDirective): """ Called by Sphinx when the ..properties:: directive is encountered. """ - self.add_rst(self.make_header("Properties")) - self.add_rst(self._populate_properties_table()) - self.commit_rst() + if self._create_properties_table(): + self.commit_rst() return [] - def _populate_properties_table(self): + def _create_properties_table(self): """ Populates the ReST table with algorithm properties. """ alg = self.create_mantid_algorithm(self.algorithm_name(), self.algorithm_version()) alg_properties = alg.getProperties() + if len(alg_properties) == 0: + return False # Stores each property of the algorithm in a tuple. properties = [] @@ -43,8 +44,9 @@ class PropertiesDirective(BaseDirective): str(prop.documentation.replace("\n", " ")) )) - # Build and add the properties to the ReST table. - return self._build_table(properties) + self.add_rst(self.make_header("Properties")) + self.add_rst(self._build_table(properties)) + return True def _build_table(self, table_content): """ -- GitLab