Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions backend/doc/domain/document_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
and eventually a final document produced.
"""

import re
import subprocess
import time
from datetime import datetime
from os.path import exists, join
from typing import Final, Mapping, Optional, Sequence, TypeAlias, cast

# import regex as re # not yet supported in python 3.13 - used for unicode word boundaries for RTL languages
import re
from celery import current_task
from doc.config import settings
from doc.domain import parsing, resource_lookup, worker
Expand Down Expand Up @@ -52,7 +51,6 @@
from doc.utils.docx_util import (
add_internal_docx_links,
generate_docx_toc,
preprocess_html_for_internal_docx_links,
style_superscripts,
)
from doc.utils.file_utils import (
Expand All @@ -75,8 +73,9 @@
from docx.shared import RGBColor
from docxcompose.composer import Composer # type: ignore
from docxtpl import DocxTemplate # type: ignore
from htmldocx import HtmlToDocx # type: ignore
from html4docx import HtmlToDocx # type: ignore

# import regex as re # not yet supported in python 3.13 - used for unicode word boundaries for RTL languages

logger = settings.logger(__name__)

Expand Down Expand Up @@ -767,8 +766,7 @@ def compose_docx_document(
else:
add_one_column_section(doc)
try:
processed_html = preprocess_html_for_internal_docx_links(part.content)
html_to_docx.add_html_to_document(processed_html, doc)
html_to_docx.add_html_to_document(part.content, doc)
except ValueError as e:
logger.exception("Error converting HTML to docx: %s", e)
if part.use_section_visual_separator:
Expand Down
Loading
Loading