Skip to content

Commit 0cadf49

Browse files
committed
update sphinx extension
1 parent cae049e commit 0cadf49

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

doc/mongoc/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from docutils.nodes import literal
1+
from docutils.nodes import literal, Text
22
from docutils.parsers.rst import roles
33

44
from sphinx.roles import XRefRole
@@ -10,13 +10,21 @@ def __call__(self, *args, **kwargs):
1010
for node in nodes:
1111
attrs = node.attributes
1212
target = attrs['reftarget']
13+
parens = ''
1314
if target.endswith('()'):
1415
# Function call, :symbol:`mongoc_init()`
1516
target = target[:-2]
17+
parens = '()'
1618

1719
if ':' in target:
1820
# E.g., 'bson:bson_t' has domain 'bson', target 'bson_t'
19-
attrs['domain'], attrs['reftarget'] = target.split(':', 1)
21+
attrs['domain'], name = target.split(':', 1)
22+
attrs['reftarget'] = name
23+
24+
assert isinstance(node.children[0].children[0], Text)
25+
node.children[0].children[0] = Text(name + parens,
26+
name + parens)
27+
2028
else:
2129
attrs['reftarget'] = target
2230

0 commit comments

Comments
 (0)