diff options
author | Stephen Finucane <sfinucan@redhat.com> | 2017-07-05 11:54:53 +0100 |
---|---|---|
committer | Stephen Finucane <sfinucan@redhat.com> | 2017-07-05 11:58:05 +0100 |
commit | 7b27ee3e424f5fb2701c1e15ffd38a87ea70023d (patch) | |
tree | c25dbbf1e66eb621a114dae6b5d856968875a15c | |
parent | 4848dfece9167cc310897d03df0263de4853572c (diff) | |
download | oslo-config-7b27ee3e424f5fb2701c1e15ffd38a87ea70023d.tar.gz |
sphinxext: Add arguments for oslo.config:group directive
The 'oslo.config:group' directive was parsing content to extract the
name of the group. However, this had the side effect of picking up any
body text, resulting is super long titles. Correct this by adding a
single required argument to the directive.
This also has the side effect of not merging the content to a single
string, meaning formatting will be preserved as expected.
Change-Id: Ie2f011f4a2a0e4918b65bd2387ee2c41f4ae9ec2
Closes-Bug: #1702453
-rw-r--r-- | oslo_config/sphinxext.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/oslo_config/sphinxext.py b/oslo_config/sphinxext.py index 896f0c8..67ab509 100644 --- a/oslo_config/sphinxext.py +++ b/oslo_config/sphinxext.py @@ -321,8 +321,9 @@ class ConfigOptXRefRole(XRefRole): class ConfigGroup(rst.Directive): + required_arguments = 1 + optional_arguments = 0 has_content = True - option_spec = { 'namespace': directives.unchanged, } @@ -331,7 +332,7 @@ class ConfigGroup(rst.Directive): env = self.state.document.settings.env app = env.app - group_name = ' '.join(self.content) + group_name = self.arguments[0] namespace = self.options.get('namespace') cached_groups = env.domaindata['oslo.config']['groups'] @@ -359,6 +360,9 @@ class ConfigGroup(rst.Directive): _add(title) _add('-' * len(title)) + _add('') + for line in self.content: + _add(line) node = nodes.section() node.document = self.state.document nested_parse_with_titles(self.state, result, node) |