AutoYADM commit: 2025-03-25 14:30:07

This commit is contained in:
Daniel Fichtinger 2025-03-25 14:30:07 -04:00
parent 2fa5e8b4c4
commit 0ec9bad428

View file

@ -2,11 +2,14 @@
# Simple text-wrapping script for email.
# Preserves code blocks, quotes, and signature.
# Automatically joins and re-wraps paragraphs to
# ensure even spacing & avoid ugly wrapping.
# Author: Daniel Fichtinger
# License: MIT
import textwrap
import sys
import re
paragraph = []
skipping = False
@ -20,22 +23,15 @@ def flush_paragraph():
for line in sys.stdin:
line = line.rstrip()
if line.startswith("```"):
flush_paragraph()
skipping = not skipping
print(line)
elif line.startswith(">"):
flush_paragraph()
print(line)
elif line.startswith(("- ", "+ ", "* ", "\t", " ")):
flush_paragraph()
print(line)
elif line.startswith("--"):
flush_paragraph()
skipping = True
print(line)
elif not line:
elif not line or re.match(r"^(\s+|-\s+|\+\s+|\*\s+|>\s*)", line):
flush_paragraph()
print(line)
elif skipping: