BigUpdate
Python application / build (push) Has been cancelled

This commit is contained in:
Igor20264
2026-09-03 10:44:08 +03:00
parent d2da20fdb2
commit 516abe7b83
177 changed files with 40178 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
"""XML escape helpers for FODT output."""
from __future__ import annotations
import re
from xml.sax.saxutils import escape as _xml_escape
def escape_text(s: str) -> str:
if not s:
return ""
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'}"