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

Method evalId

markdown/inlinepatterns.py:1255–1269  ·  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

1253 return self.makeTag(href, title, text), m.start(0), end
1254
1255 def evalId(self, data: str, index: int, text: str) -> tuple[str | None, int, bool]:
1256 """
1257 Evaluate the id portion of `[ref][id]`.
1258
1259 If `[ref][]` use `[ref]`.
1260 """
1261 m = self.RE_LINK.match(data, pos=index)
1262 if not m:
1263 return None, index, False
1264 else:
1265 id = m.group(1).lower()
1266 end = m.end(0)
1267 if not id:
1268 id = text.lower()
1269 return id, end, True
1270
1271 def makeTag(self, href: str, title: str, text: str) -> etree.Element:
1272 """ Return an `a` [`Element`][xml.etree.ElementTree.Element]. """

Callers 1

handleMatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected