Add example and type options to attributes
As described; this is used in the nodepool configuration documentation. Change-Id: Iad188fd69818762cc9bad927beaff55749e0385c
This commit is contained in:
parent
0165692e62
commit
0210c9df03
@ -11,6 +11,8 @@ Configuration Attributes
|
||||
|
||||
.. attr:: foo
|
||||
:default: bar
|
||||
:example: sample_value_for_example_attr
|
||||
:type: str
|
||||
|
||||
A sub attribute.
|
||||
|
||||
|
@ -328,6 +328,8 @@ class ZuulAttrDirective(ZuulObjectDescription):
|
||||
'required': lambda x: x,
|
||||
'default': lambda x: x,
|
||||
'noindex': lambda x: x,
|
||||
'example': lambda x: x,
|
||||
'type': lambda x: x,
|
||||
}
|
||||
|
||||
def before_content(self):
|
||||
@ -361,6 +363,18 @@ class ZuulAttrDirective(ZuulObjectDescription):
|
||||
line += nodes.literal(self.options['default'],
|
||||
self.options['default'])
|
||||
signode += line
|
||||
if 'example' in self.options:
|
||||
line = addnodes.desc_signature_line()
|
||||
line += addnodes.desc_type('Example: ', 'Example: ')
|
||||
line += nodes.literal(self.options['example'],
|
||||
self.options['example'])
|
||||
signode += line
|
||||
if 'type' in self.options:
|
||||
line = addnodes.desc_signature_line()
|
||||
line += addnodes.desc_type('Type: ', 'Type: ')
|
||||
line += nodes.emphasis(self.options['type'],
|
||||
self.options['type'])
|
||||
signode += line
|
||||
return sig
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user