mirror of
https://github.com/docling-project/docling-serve.git
synced 2025-11-30 00:53:18 +00:00
21 lines
477 B
Python
21 lines
477 B
Python
from pyjsx import JSX # type: ignore
|
|
|
|
|
|
def _tag(name: str):
|
|
def factory(children, **args) -> JSX:
|
|
props = " ".join([f'{k}="{v}"' for k, v in args.items()])
|
|
|
|
if children:
|
|
child_renders = "".join([str(c) for c in children])
|
|
return f"<{name} {props}>{child_renders}</{name}>"
|
|
else:
|
|
return f"<{name} {props} />"
|
|
|
|
return factory
|
|
|
|
|
|
image = _tag("image")
|
|
path = _tag("path")
|
|
rect = _tag("rect")
|
|
text = _tag("text")
|