I have some Python documentation, the source of part of which looks like 
this:

.. class:: MyClass(stream, **kwargs)

   :param stream: The stream containing the text to be read.

   :param kwargs: Keyword arguments.

   :var bar: Bar

   :var baz: Baz

This renders to HTML like this:


[image: ss1.png]
I want to introduce a new category of parameter, whose source might be

   :myparam fizz: Fizz

   :myparam buzz: Buzz

which I want to render in a similar way:

[image: ss2.png]
I had thought to achieve this by adding an entry to the doc_field_types 
attribute of the PyObject class in the sphinx.domains.python module, but 
that doesn't seem to work. The original value of the list is

        PyTypedField('parameter', label=_('Parameters'),
                     names=('param', 'parameter', 'arg', 'argument',
                            'keyword', 'kwarg', 'kwparam'),
                     typerolename='class', typenames=('paramtype', 'type'),
                     can_collapse=True),
        PyTypedField('variable', label=_('Variables'), rolename='obj',
                     names=('var', 'ivar', 'cvar'),
                     typerolename='class', typenames=('vartype',),
                     can_collapse=True),
        PyGroupedField('exceptions', label=_('Raises'), rolename='exc',
                       names=('raises', 'raise', 'exception', 'except'),
                       can_collapse=True),
        Field('returnvalue', label=_('Returns'), has_arg=False,
              names=('returns', 'return')),
        PyField('returntype', label=_('Return type'), has_arg=False,
                names=('rtype',), bodyrolename='class'),

and I tried inserting a 

        PyTypedField('myparam', label=_('My Parameters'),
                     names=('myarg_alias1', 'myarg_alias2'),
                     typerolename='class', typenames=('paramtype', 'type'),
                     can_collapse=True),

after the first entry (basically, like a parameter but with a different 
label and myparam keyword). However, the resulting HTML is like this:

[image: ss3.png]


What's the correct approach to obtain the result I want?

Regards,

Vinay Sajip

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/c96cea17-d9f1-40fd-ae14-7ac1c7af2d7d%40googlegroups.com.

Reply via email to