mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Regression of #77: If there is only one parameter given with `:param:
` markup, the bullet list is now suppressed again.
This commit is contained in:
parent
0cda61e88d
commit
205d50a01d
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
Release 1.0.6 (in development)
|
||||
==============================
|
||||
|
||||
* Regression of #77: If there is only one parameter given with
|
||||
``:param:`` markup, the bullet list is now suppressed again.
|
||||
|
||||
* #556: Fix missing paragraph breaks in LaTeX output in certain
|
||||
situations.
|
||||
|
||||
|
@ -94,10 +94,12 @@ class PyObject(ObjectDescription):
|
||||
TypedField('parameter', label=l_('Parameters'),
|
||||
names=('param', 'parameter', 'arg', 'argument',
|
||||
'keyword', 'kwarg', 'kwparam'),
|
||||
typerolename='obj', typenames=('paramtype', 'type')),
|
||||
typerolename='obj', typenames=('paramtype', 'type'),
|
||||
can_collapse=True),
|
||||
TypedField('variable', label=l_('Variables'), rolename='obj',
|
||||
names=('var', 'ivar', 'cvar'),
|
||||
typerolename='obj', typenames=('vartype',)),
|
||||
typerolename='obj', typenames=('vartype',),
|
||||
can_collapse=True),
|
||||
GroupedField('exceptions', label=l_('Raises'), rolename='exc',
|
||||
names=('raises', 'raise', 'exception', 'except'),
|
||||
can_collapse=True),
|
||||
|
@ -129,15 +129,13 @@ class TypedField(GroupedField):
|
||||
is_typed = True
|
||||
|
||||
def __init__(self, name, names=(), typenames=(), label=None,
|
||||
rolename=None, typerolename=None):
|
||||
GroupedField.__init__(self, name, names, label, rolename, False)
|
||||
rolename=None, typerolename=None, can_collapse=False):
|
||||
GroupedField.__init__(self, name, names, label, rolename, can_collapse)
|
||||
self.typenames = typenames
|
||||
self.typerolename = typerolename
|
||||
|
||||
def make_field(self, types, domain, items):
|
||||
fieldname = nodes.field_name('', self.label)
|
||||
listnode = self.list_type()
|
||||
for fieldarg, content in items:
|
||||
def handle_item(fieldarg, content):
|
||||
par = nodes.paragraph()
|
||||
par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong)
|
||||
if fieldarg in types:
|
||||
@ -154,8 +152,17 @@ class TypedField(GroupedField):
|
||||
par += nodes.Text(')')
|
||||
par += nodes.Text(' -- ')
|
||||
par += content
|
||||
listnode += nodes.list_item('', par)
|
||||
fieldbody = nodes.field_body('', listnode)
|
||||
return par
|
||||
|
||||
fieldname = nodes.field_name('', self.label)
|
||||
if len(items) == 1 and self.can_collapse:
|
||||
fieldarg, content = items[0]
|
||||
bodynode = handle_item(fieldarg, content)
|
||||
else:
|
||||
bodynode = self.list_type()
|
||||
for fieldarg, content in items:
|
||||
bodynode += nodes.list_item('', handle_item(fieldarg, content))
|
||||
fieldbody = nodes.field_body('', bodynode)
|
||||
return nodes.field('', fieldname, fieldbody)
|
||||
|
||||
|
||||
|
@ -47,6 +47,8 @@ Testing object descriptions
|
||||
|
||||
.. class:: TimeInt
|
||||
|
||||
Has only one parameter (triggers special behavior...)
|
||||
|
||||
:param moo: |test|
|
||||
:type moo: |test|
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user