From bb6e941e1410f6324bc26a6ef4783eaa99f28d46 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 25 Mar 2025 01:45:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-25 01:45:07 --- .config/mail/format.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.config/mail/format.py b/.config/mail/format.py index 5f66c59c..5b603f1b 100755 --- a/.config/mail/format.py +++ b/.config/mail/format.py @@ -23,6 +23,7 @@ import sys skipping = False +in_par = False for line in sys.stdin: if line.startswith(">"): # ignore quoted line @@ -34,8 +35,23 @@ for line in sys.stdin: elif line.startswith("--"): skipping = True print(line, end = "") + elif not line.rstrip(): + in_par = not in_par + print() + # print(line, end="") else: - # wrap the line + if not skipping and in_par: + par = [] + for next_line in sys.stdin: + # if not line.startswith((">", "```", "--")): + stripped = next_line.rstrip() + if stripped: + par.append(stripped) + else: + in_par = False + line = " ".join(par) + # empty line, treat next section as paragraph + # TODO: fix signature being mangled and newlines erased if not skipping: wrapped = textwrap.wrap(line, width=74, break_long_words=False, replace_whitespace=True)