This commit is contained in:
2025-09-08 18:35:52 +02:00
parent efdb24afcf
commit e2bf3e945d

View File

@@ -457,12 +457,15 @@ def subtitle():
paras = [p.strip() for p in re.split(r"\n{2,}", safe) if p.strip()]
clean_paras = [re.sub(r'[\n\r]+', ' ', p) for p in paras[:2000]]
items = "".join(f"<p>{p}</p>" for p in clean_paras)
# Build fallback without using backslashes inside an f-string expression
fallback = f"<pre style='white-space:pre-wrap'>{safe}</pre>"
body = items if items else fallback
return (
"<!doctype html><meta charset='utf-8'>"
"<title>Transcript</title>"
"<style>body{font-family:system-ui;margin:1rem;line-height:1.6;max-width:900px} p{margin:.4rem 0}</style>"
f"<h3>Transcript (plain text): {base}</h3>"
f"{items or '<pre style=\"white-space:pre-wrap\">'+safe+'</pre>'}"
f"{body}"
)
else:
return "<small>No transcript found.</small>"