Fixes #1915: Do not generate smart quotes in doc field type annotations.

This commit is contained in:
Georg Brandl 2015-07-25 12:35:52 +02:00
parent ae7e3afb4f
commit 657f6b16f0
2 changed files with 5 additions and 3 deletions

View File

@ -32,6 +32,7 @@ Bugs fixed
* Work around the lack of the HTMLParserError exception in Python 3.5. * Work around the lack of the HTMLParserError exception in Python 3.5.
* #1949: Use ``safe_getattr`` in the coverage builder to avoid aborting with * #1949: Use ``safe_getattr`` in the coverage builder to avoid aborting with
descriptors that have custom behavior. descriptors that have custom behavior.
* #1915: Do not generate smart quotes in doc field type annotations.
Release 1.3.1 (released Mar 17, 2015) Release 1.3.1 (released Mar 17, 2015)

View File

@ -53,8 +53,8 @@ class Field(object):
self.rolename = rolename self.rolename = rolename
self.bodyrolename = bodyrolename self.bodyrolename = bodyrolename
def make_xref(self, rolename, domain, target, innernode=nodes.emphasis, def make_xref(self, rolename, domain, target,
contnode=None): innernode=addnodes.literal_emphasis, contnode=None):
if not rolename: if not rolename:
return contnode or innernode(target, target) return contnode or innernode(target, target)
refnode = addnodes.pending_xref('', refdomain=domain, refexplicit=False, refnode = addnodes.pending_xref('', refdomain=domain, refexplicit=False,
@ -159,7 +159,8 @@ class TypedField(GroupedField):
fieldtype = types.pop(fieldarg) fieldtype = types.pop(fieldarg)
if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
typename = u''.join(n.astext() for n in fieldtype) typename = u''.join(n.astext() for n in fieldtype)
par += self.make_xref(self.typerolename, domain, typename) par += self.make_xref(self.typerolename, domain, typename,
addnodes.literal_emphasis)
else: else:
par += fieldtype par += fieldtype
par += nodes.Text(')') par += nodes.Text(')')