MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / evalId

Method evalId

markdown/inlinepatterns.py:1367–1381  ·  view source on GitHub ↗

Evaluate the id portion of `[ref][id]`. If `[ref][]` use `[ref]`.

(self, data: str, index: int, text: str)

Source from the content-addressed store, hash-verified

1365 return self.makeTag(href, title, text), m.start(0), end
1366
1367 def evalId(self, data: str, index: int, text: str) -> tuple[str | None, int, bool]:
1368 """
1369 Evaluate the id portion of `[ref][id]`.
1370
1371 If `[ref][]` use `[ref]`.
1372 """
1373 m = self.RE_LINK.match(data, pos=index)
1374 if not m:
1375 return None, index, False
1376 else:
1377 id = m.group(1).lower()
1378 end = m.end(0)
1379 if not id:
1380 id = text.lower()
1381 return id, end, True
1382
1383 def makeTag(self, href: str, title: str, text: str) -> etree.Element:
1384 """ Return an `a` [`Element`][xml.etree.ElementTree.Element]. """

Callers 1

handleMatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected