v0.5.3
Example document / build (push) Has been cancelled
Python application / build (push) Has been cancelled

- Мелкие исправления увеличивающие работу конвертера
This commit is contained in:
Igor20264
2026-09-10 10:50:15 +03:00
parent 658036f920
commit f7136bd8bd
95 changed files with 7165 additions and 8771 deletions
+3 -8
View File
@@ -2,9 +2,10 @@
from __future__ import annotations
import re
from xml.sax.saxutils import escape as _xml_escape
from mdexport.labels import sanitize_label
def escape_text(s: str) -> str:
if not s:
@@ -12,11 +13,5 @@ def escape_text(s: str) -> str:
return _xml_escape(s, {"\"": """, "'": "'"})
_LABEL_RE = re.compile(r"[^\w\-]+", re.UNICODE)
def xml_id(name: str | None, prefix: str = "obj") -> str:
if not name:
return prefix
cleaned = _LABEL_RE.sub("-", name.strip()).strip("-")
return f"{prefix}-{cleaned or 'x'}"
return sanitize_label(name, prefix, "-")