vibe.templates_mgmt.docx_utils¶
Docx File Processing Utilities.
Provides helper functions for working with Docx files within the template provider, specifically for extracting text content, converting Markdown/HTML snippets into DOCX subdocuments, and identifying structural markers.
extract_text_with_markers ¶
extract_text_with_markers(tree: _Element) -> str
Traverses Docx XML, extracts text, and inserts VIBE markers.
render_markdown_to_docx_subdoc ¶
render_markdown_to_docx_subdoc(markdown_text: str, host_doc: DocxTemplate) -> Subdoc
Render Markdown text into a DOCX subdocument attached to host_doc.
render_html_to_docx_subdoc ¶
render_html_to_docx_subdoc(html_string: str, host_doc: DocxTemplate) -> Subdoc
Render sanitized HTML into a DOCX subdoc for insertion into docxtpl host.
preprocess_template_for_analysis ¶
preprocess_template_for_analysis(template_content: str) -> str
Preprocesses a Jinja template string for static analysis.
Ensures each control structure tag (if, for, endif, etc.) starts on a new line, and flattens conditions within if/elif/for tags to a single line. Attempts to preserve content within {% raw %} blocks.
| Parameters: |
|
|---|
| Returns: |
|
|---|