From 4780a2b19acfbfbcab958c14b8a04d9f9a6669d4 Mon Sep 17 00:00:00 2001 From: xunbu Date: Fri, 10 Oct 2025 11:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96txt=E8=AF=91=E6=96=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exporter/txt/txt2html_exporter.py | 5 +---- docutranslate/template/txt.html | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docutranslate/exporter/txt/txt2html_exporter.py b/docutranslate/exporter/txt/txt2html_exporter.py index 8f85b5d..fedfbaf 100644 --- a/docutranslate/exporter/txt/txt2html_exporter.py +++ b/docutranslate/exporter/txt/txt2html_exporter.py @@ -26,12 +26,9 @@ class TXT2HTMLExporter(TXTExporter): html_template = resource_path("template/txt.html").read_text(encoding="utf-8") # language=html - pico = f'' if not cdn else r'' - - body='\n'.join([r'

'+para+'

' for para in document.content.decode().split("\n")]) + body=document.content.decode() render = jinja2.Template(html_template).render( title=document.stem, - pico=pico, body=body, ) return Document.from_bytes(content=render.encode("utf-8"), suffix=".html", stem=document.stem) diff --git a/docutranslate/template/txt.html b/docutranslate/template/txt.html index dfcd23b..8a5076b 100644 --- a/docutranslate/template/txt.html +++ b/docutranslate/template/txt.html @@ -3,15 +3,26 @@ {{ title }} - {{pico}} -{{ body }} +
{{ body }}
\ No newline at end of file