MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / handleMatch

Method handleMatch

markdown/inlinepatterns.py:225–241  ·  view source on GitHub ↗
(self, m)

Source from the content-addressed store, hash-verified

223class LinkPattern (Pattern):
224 """ Return a link element from the given match. """
225 def handleMatch(self, m):
226 el = markdown.etree.Element("a")
227 el.text = m.group(2)
228 title = m.group(11)
229 href = m.group(9)
230
231 if href:
232 if href[0] == "<":
233 href = href[1:-1]
234 el.set("href", self.sanitize_url(href.strip()))
235 else:
236 el.set("href", "")
237
238 if title:
239 title = dequote(title) #.replace('"', "&quot;")
240 el.set("title", title)
241 return el
242
243 def sanitize_url(self, url):
244 """

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
sanitize_urlMethod · 0.95
dequoteFunction · 0.85

Tested by

no test coverage detected