diff options
author | Georg Brandl <georg@python.org> | 2014-01-12 20:30:25 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-12 20:30:25 +0100 |
commit | d68a60584728f81beffc95debdfe54b37c03be05 (patch) | |
tree | 76dbb1469f4f82d747b8ba5e2049c71a24a05635 /sphinx/domains | |
parent | b2694d81fb8f7e59ccdf331ddabab754cc3073a1 (diff) | |
parent | d61a0654af869787b0fdcf4e4fd788722e06585d (diff) | |
download | sphinx-d68a60584728f81beffc95debdfe54b37c03be05.tar.gz |
merge with stable
Diffstat (limited to 'sphinx/domains')
-rw-r--r-- | sphinx/domains/python.py | 4 | ||||
-rw-r--r-- | sphinx/domains/std.py | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 63d388c8..6714e838 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -576,8 +576,8 @@ class PythonDomain(Domain): object_types = { 'function': ObjType(l_('function'), 'func', 'obj'), 'data': ObjType(l_('data'), 'data', 'obj'), - 'class': ObjType(l_('class'), 'class', 'obj'), - 'exception': ObjType(l_('exception'), 'exc', 'obj'), + 'class': ObjType(l_('class'), 'class', 'exc', 'obj'), + 'exception': ObjType(l_('exception'), 'exc', 'class', 'obj'), 'method': ObjType(l_('method'), 'meth', 'obj'), 'classmethod': ObjType(l_('class method'), 'meth', 'obj'), 'staticmethod': ObjType(l_('static method'), 'meth', 'obj'), diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index d5c92387..895e35e5 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -27,8 +27,7 @@ from sphinx.util.compat import Directive # RE for option descriptions -option_desc_re = re.compile( - r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') +option_desc_re = re.compile(r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*)') class GenericObject(ObjectDescription): @@ -130,14 +129,23 @@ class Target(Directive): class Cmdoption(ObjectDescription): """ - Description of a command-line option (.. cmdoption). + Description of a command-line option (.. option). """ def handle_signature(self, sig, signode): """Transform an option description into RST nodes.""" count = 0 firstname = '' - for m in option_desc_re.finditer(sig): + for potential_option in sig.split(', '): + potential_option = potential_option.strip() + m = option_desc_re.match(potential_option) + if not m: + self.env.warn( + self.env.docname, + 'Malformed option description %r, should ' + 'look like "-opt args", "--opt args" or ' + '"/opt args"' % potential_option, self.lineno) + continue optname, args = m.groups() if count: signode += addnodes.desc_addname(', ', ', ') |