Source

sphinx / sphinx / roles.py

Diff from to

sphinx/roles.py

     else:
         # remove all whitespace to avoid referencing problems
         target = ws_re.sub('', target)
+    pnode['refdoc'] = env.docname
     pnode['reftarget'] = target
     pnode += innernodetypes.get(typ, nodes.literal)(rawtext, title,
                                                     classes=['xref'])