From fadf9c9d31714dd7a35a52891909d9c579788384 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 25 Mar 2025 13:45:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-25 13:45:07 --- .config/mail/1742924137042008814_13717.py | 4 ++++ .config/mail/format.py | 22 +++++++++++++++------- .config/mail/test2.txt | 5 +++++ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100755 .config/mail/1742924137042008814_13717.py create mode 100644 .config/mail/test2.txt diff --git a/.config/mail/1742924137042008814_13717.py b/.config/mail/1742924137042008814_13717.py new file mode 100755 index 00000000..d9124dd6 --- /dev/null +++ b/.config/mail/1742924137042008814_13717.py @@ -0,0 +1,4 @@ +#!/bin/env python + +print("test") + diff --git a/.config/mail/format.py b/.config/mail/format.py index f557b113..538fd78a 100755 --- a/.config/mail/format.py +++ b/.config/mail/format.py @@ -24,7 +24,11 @@ import sys skipping = False in_par = False -for line in sys.stdin: +running = True +while running: + line = sys.stdin.readline() + if line == '': + running = False if line.startswith(">"): # ignore quoted line print(line, end = "") @@ -39,27 +43,31 @@ for line in sys.stdin: # Empty line in_par = not in_par print() + print("printing empty line") # print(line, end="") else: if not skipping and in_par: par = [] - for next_line in sys.stdin: + while True: + next_line = sys.stdin.readline() # if not line.startswith((">", "```", "--")): stripped = next_line.rstrip() - print("runs") + # print(next_line) + # print("runs") if stripped: - print("runs") + # print("runs strip") par.append(stripped) else: in_par = False - par.append("\n") + print("breaking par") + # par.append("\n") break line = " ".join(par) - print(par) + # print(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) - print("\n".join(wrapped)) + print("\n".join(wrapped), end="") else: print(line, end = "") diff --git a/.config/mail/test2.txt b/.config/mail/test2.txt new file mode 100644 index 00000000..f7bf0548 --- /dev/null +++ b/.config/mail/test2.txt @@ -0,0 +1,5 @@ +test one + +test two + +test three