Moar fix
This commit is contained in:
@@ -457,12 +457,15 @@ def subtitle():
|
|||||||
paras = [p.strip() for p in re.split(r"\n{2,}", safe) if p.strip()]
|
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]]
|
clean_paras = [re.sub(r'[\n\r]+', ' ', p) for p in paras[:2000]]
|
||||||
items = "".join(f"<p>{p}</p>" for p in clean_paras)
|
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 (
|
return (
|
||||||
"<!doctype html><meta charset='utf-8'>"
|
"<!doctype html><meta charset='utf-8'>"
|
||||||
"<title>Transcript</title>"
|
"<title>Transcript</title>"
|
||||||
"<style>body{font-family:system-ui;margin:1rem;line-height:1.6;max-width:900px} p{margin:.4rem 0}</style>"
|
"<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"<h3>Transcript (plain text): {base}</h3>"
|
||||||
f"{items or '<pre style=\"white-space:pre-wrap\">'+safe+'</pre>'}"
|
f"{body}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return "<small>No transcript found.</small>"
|
return "<small>No transcript found.</small>"
|
||||||
|
Reference in New Issue
Block a user