3 from docutils import nodes, utils
5 class vref(nodes.Inline, nodes.TextElement):
8 def vref_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
9 latex = utils.unescape(text, restore_backslashes=True)
10 return [vref(latex=latex)], []
12 def latex_visit_vref(self, node):
13 self.body.append(r'\vref{' + node['latex'] + '}')
17 app.add_node(vref, latex=(latex_visit_vref, None))
18 app.add_role('vref', vref_role)