From b69289cd926d44e08c7d139b3487bf5e1d432aad Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 27 Jul 2020 11:38:05 -0400 Subject: Fix some of the more common trailer wrapping When copypasting patches into mail clients, trailers sometimes get mangled due to MUAs helpfully breaking long lines. Not sure if this causes more harm than good, but let's try to run some tests with this. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/b4/__init__.py b/b4/__init__.py index 56dd751..245a0db 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1215,6 +1215,14 @@ class LoreMessage: mbody = parts[0].strip('\n') + # Fix some more common copypasta trailer wrapping + # Fixes: abcd0123 (foo bar + # baz quux) + mbody = re.sub(r'^(\S+:\s+[0-9a-f]+\s+\([^\)]+)\n([^\n]+\))', r'\1 \2', mbody, flags=re.M) + # Signed-off-by: Long Name + # + mbody = re.sub(r'^(\S+:\s+[^<]+)\n(<[^>]+>)', r'\1 \2', mbody, flags=re.M) + # Split into paragraphs bpara = mbody.split('\n\n') -- cgit v1.2.3