summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2018-09-21 15:54:53 +1000
committerIan Wienand <iwienand@redhat.com>2018-09-26 07:34:17 +1000
commit0210c9df03d0c2098a2ff7024f491afdc36ca071 (patch)
tree32cee21431de001f273306345a89f73a95083bc9
parent0165692e62a5e7e009b80d78c8a6099e29a4d8a7 (diff)
Add example and type options to attributes
As described; this is used in the nodepool configuration documentation. Change-Id: Iad188fd69818762cc9bad927beaff55749e0385c
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: Tobias Henkel <tobias.henkel@bmw.de> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 11 Oct 2018 19:22:45 +0000 Reviewed-on: https://review.openstack.org/604267 Project: openstack-infra/zuul-sphinx Branch: refs/heads/master
-rw-r--r--doc/source/examples.rst2
-rw-r--r--zuul_sphinx/zuul.py14
2 files changed, 16 insertions, 0 deletions
diff --git a/doc/source/examples.rst b/doc/source/examples.rst
index ad175cb..3986fd8 100644
--- a/doc/source/examples.rst
+++ b/doc/source/examples.rst
@@ -11,6 +11,8 @@ Configuration Attributes
11 11
12 .. attr:: foo 12 .. attr:: foo
13 :default: bar 13 :default: bar
14 :example: sample_value_for_example_attr
15 :type: str
14 16
15 A sub attribute. 17 A sub attribute.
16 18
diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py
index c9dbf01..a2e6381 100644
--- a/zuul_sphinx/zuul.py
+++ b/zuul_sphinx/zuul.py
@@ -328,6 +328,8 @@ class ZuulAttrDirective(ZuulObjectDescription):
328 'required': lambda x: x, 328 'required': lambda x: x,
329 'default': lambda x: x, 329 'default': lambda x: x,
330 'noindex': lambda x: x, 330 'noindex': lambda x: x,
331 'example': lambda x: x,
332 'type': lambda x: x,
331 } 333 }
332 334
333 def before_content(self): 335 def before_content(self):
@@ -361,6 +363,18 @@ class ZuulAttrDirective(ZuulObjectDescription):
361 line += nodes.literal(self.options['default'], 363 line += nodes.literal(self.options['default'],
362 self.options['default']) 364 self.options['default'])
363 signode += line 365 signode += line
366 if 'example' in self.options:
367 line = addnodes.desc_signature_line()
368 line += addnodes.desc_type('Example: ', 'Example: ')
369 line += nodes.literal(self.options['example'],
370 self.options['example'])
371 signode += line
372 if 'type' in self.options:
373 line = addnodes.desc_signature_line()
374 line += addnodes.desc_type('Type: ', 'Type: ')
375 line += nodes.emphasis(self.options['type'],
376 self.options['type'])
377 signode += line
364 return sig 378 return sig
365 379
366 380