59 def handleMatch(self, m, data):
60 text = m.group('text')
61 symbol = m.group('symbol')
62 if symbol is None:
63 symbol = m.group('target')
64
65 uri = self._resolve_ref(symbol) or '#broken-link'
66
67
68
69 self.md.xrefs[f"`{symbol}`"] = uri
70
71
72
73 anchor = etree.Element('a')
74 anchor.attrib['href'] = uri
75 anchor.attrib['target'] = '_blank'
76 if text is not None:
77 anchor.text = text
78 else:
79 code = etree.Element('code')
80 code.text = re.sub(r'^dart::', '', symbol)
81 anchor.append(code)
82
83
84 return anchor, m.start(0), m.end(0)
85