diff --git a/doc/source/example-roles.rst b/doc/source/example-roles.rst index b32022e..afa9539 100644 --- a/doc/source/example-roles.rst +++ b/doc/source/example-roles.rst @@ -25,6 +25,21 @@ Roles This is an item in a list. + .. rolevar:: dict + :type: dict + + This variable is a dict. + + .. rolevar:: key + + This is a key which should be assigned a value. + + .. rolevar:: flag-value + :type: bool + :default: False + + A variable which should be assigned a True/False value. + This is an (Ansible) role (Sphinx) role: :role:`example` This is an (Ansible) role variable (Sphinx) role: :rolevar:`example.items.baz` diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py index 37a6bd3..32b5e0c 100644 --- a/zuul_sphinx/zuul.py +++ b/zuul_sphinx/zuul.py @@ -404,7 +404,7 @@ class ZuulVarDirective(ZuulObjectDescription): } def get_type_str(self): - if 'type' in self.options: + if 'type' in self.options and self.options['type'] in self.type_map: return self.type_map[self.options['type']] return '' @@ -443,6 +443,12 @@ class ZuulVarDirective(ZuulObjectDescription): line += nodes.literal(self.options['default'], self.options['default']) 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