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
|
.. attr:: foo
|
||||||
:default: bar
|
:default: bar
|
||||||
|
:example: sample_value_for_example_attr
|
||||||
|
:type: str
|
||||||
|
|
||||||
A sub attribute.
|
A sub attribute.
|
||||||
|
|
||||||
|
@ -328,6 +328,8 @@ class ZuulAttrDirective(ZuulObjectDescription):
|
|||||||
'required': lambda x: x,
|
'required': lambda x: x,
|
||||||
'default': lambda x: x,
|
'default': lambda x: x,
|
||||||
'noindex': lambda x: x,
|
'noindex': lambda x: x,
|
||||||
|
'example': lambda x: x,
|
||||||
|
'type': lambda x: x,
|
||||||
}
|
}
|
||||||
|
|
||||||
def before_content(self):
|
def before_content(self):
|
||||||
@ -361,6 +363,18 @@ class ZuulAttrDirective(ZuulObjectDescription):
|
|||||||
line += nodes.literal(self.options['default'],
|
line += nodes.literal(self.options['default'],
|
||||||
self.options['default'])
|
self.options['default'])
|
||||||
signode += line
|
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
|
return sig
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user