MCPcopy
hub / github.com/HKUDS/RAG-Anything / _convert

Function _convert

raganything/omml_extractor.py:360–375  ·  view source on GitHub ↗
(element: Optional[ET.Element])

Source from the content-addressed store, hash-verified

358
359
360def _convert(element: Optional[ET.Element]) -> str:
361 if element is None:
362 return ""
363
364 tag = _local_name(element.tag)
365 handler = _HANDLERS.get(tag)
366 if handler is not None:
367 return handler(element)
368
369 # Generic fallback: concatenate child conversions, then own text.
370 parts = [_text_for(element)]
371 for child in element:
372 parts.append(_convert(child))
373 if child.tail:
374 parts.append(_escape_text(child.tail))
375 return "".join(p for p in parts if p)
376
377
378def _local_name(qname: str) -> str:

Callers 3

omml_to_latexFunction · 0.85
_convert_childrenFunction · 0.85
_h_omath_paraFunction · 0.85

Calls 4

_local_nameFunction · 0.85
_text_forFunction · 0.85
_escape_textFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected