fix #1772 cross reference in docstrings like `:param .write:` breaks building.

This commit is contained in:
shimizukawa committed 2015-03-14 18:54:20 +09:00
1 parent 4e599c13da
commit 70612c610f
2 files changed
+10 -7

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ Bugs fixed
doesn't overwrite existent files/dirs. Thanks to WAKAYAMA shirou.
* #1773: sphinx-quickstart doesn't accept non-ASCII character as a option argument.
* #1766: the message "least Python 2.6 to run" is at best misleading.
* #1772: cross reference in docstrings like ``:param .write:`` breaks building.
Release 1.3 (released Mar 10, 2015)
+9 -7
View File
@@ -90,13 +90,15 @@ class PyXrefMixin(object):
result = super(PyXrefMixin, self).make_xref(rolename, domain, target,
innernode, contnode)
result['refspecific'] = True
if target.startswith('.'):
result['reftarget'] = target[1:]
result[0][0] = nodes.Text(target[1:])
if target.startswith('~'):
result['reftarget'] = target[1:]
title = target.split('.')[-1]
result[0][0] = nodes.Text(title)
if target.startswith(('.', '~')):
prefix, result['reftarget'] = target[0], target[1:]
if prefix == '.':
text = target[1:]
elif prefix == '~':
text = target.split('.')[-1]
for node in result.traverse(nodes.Text):
node.parent[node.parent.index(node)] = nodes.Text(text)
break
return result