fix: typst single backslash linebreaks and dual theme OMML parity
This commit is contained in:
1 parent
2ab4f60a0f
commit
649fe5f9ef
3 files changed
+107
-68
No files matched your search
@@ -116,21 +116,12 @@ def _execute_render_pipeline(source: dict, theme_name: str, job_id: str) -> str:
|
||||
except Exception as e:
|
||||
journal_lines.append(f"Avertissement image annexe : {e}")
|
||||
|
||||
# 5. Rendu DOCX avec OMML natif
|
||||
output_docx_path = os.path.join(job_dir, "output.docx")
|
||||
try:
|
||||
docx_meta = renderer_docx.render_docx(source, theme_tokens, output_docx_path, figures_map)
|
||||
journal_lines.append(f"DOCX rendu avec succès : {docx_meta['omath']} formules OMML, {docx_meta['draw']} figures, {docx_meta['dollar']} dollar(s)")
|
||||
except Exception as e:
|
||||
journal_lines.append(f"ERREUR rendu DOCX : {e}")
|
||||
with open(os.path.join(job_dir, "journal.log"), "w", encoding="utf-8") as f:
|
||||
f.write("\n".join(journal_lines))
|
||||
raise HTTPException(status_code=500, detail=f"Erreur rendu DOCX : {e}")
|
||||
|
||||
# 6. Rendu PDF avec Typst
|
||||
# 5. Rendu PDF avec Typst (génère le PDF et extrait le texte de référence)
|
||||
output_pdf_path = os.path.join(job_dir, "output.pdf")
|
||||
pdf_text = None
|
||||
try:
|
||||
pdf_meta = renderer_typst.render_typst(source, theme_tokens, output_pdf_path, figures_map=figures_map)
|
||||
pdf_text = pdf_meta.get("texte")
|
||||
journal_lines.append(f"PDF rendu avec succès : {pdf_meta['pages']} page(s) calibrée(s)")
|
||||
except Exception as e:
|
||||
journal_lines.append(f"ERREUR rendu PDF : {e}")
|
||||
@@ -138,6 +129,17 @@ def _execute_render_pipeline(source: dict, theme_name: str, job_id: str) -> str:
|
||||
f.write("\n".join(journal_lines))
|
||||
raise HTTPException(status_code=500, detail=f"Erreur rendu PDF : {e}")
|
||||
|
||||
# 6. Rendu DOCX avec OMML natif
|
||||
output_docx_path = os.path.join(job_dir, "output.docx")
|
||||
try:
|
||||
docx_meta = renderer_docx.render_docx(source, theme_tokens, output_docx_path, figures_map, pdf_text=pdf_text)
|
||||
journal_lines.append(f"DOCX rendu avec succès : {docx_meta['omath']} formules OMML, {docx_meta['draw']} figures, {docx_meta['dollar']} dollar(s)")
|
||||
except Exception as e:
|
||||
journal_lines.append(f"ERREUR rendu DOCX : {e}")
|
||||
with open(os.path.join(job_dir, "journal.log"), "w", encoding="utf-8") as f:
|
||||
f.write("\n".join(journal_lines))
|
||||
raise HTTPException(status_code=500, detail=f"Erreur rendu DOCX : {e}")
|
||||
|
||||
journal_lines.append(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Fin normale du job {job_id}")
|
||||
with open(os.path.join(job_dir, "journal.log"), "w", encoding="utf-8") as f:
|
||||
f.write("\n".join(journal_lines))
|
||||
|
||||
Reference in new issue
Block a user