Files
md_to_gost/md2fodt/escape.py
T
Igor20264 e6b58efeb3
Example document / build (push) Has been cancelled
Python application / build (push) Has been cancelled
v0.5.3
- Мелкие исправления увеличивающие работу конвертера
2026-09-10 10:50:15 +03:00

18 lines
404 B
Python

"""XML escape helpers for FODT output."""
from __future__ import annotations
from xml.sax.saxutils import escape as _xml_escape
from mdexport.labels import sanitize_label
def escape_text(s: str) -> str:
if not s:
return ""
return _xml_escape(s, {"\"": """, "'": "'"})
def xml_id(name: str | None, prefix: str = "obj") -> str:
return sanitize_label(name, prefix, "-")