From 3a2a30af339ddc3237610da396e16a8b6634663e Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 20 Jan 2022 16:58:36 -0500 Subject: [PATCH] Add a fix-eml.py script For trying to fix up patches mangled by Outlook Signed-off-by: Anna Schumaker --- fix-eml.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 fix-eml.py diff --git a/fix-eml.py b/fix-eml.py new file mode 100755 index 0000000..124cbdb --- /dev/null +++ b/fix-eml.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +import re +import sys + +if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} FILE") + sys.exit(1) + +with open(sys.argv[1]) as f: + line = "" + for l in f: + if len(l) == 77 and l[-2] == "=": + line += l[:-2] + else: + line += l + if not re.match("NetApp Security WARNING:", line): + line = re.sub("^\+ ", "+ ", line, count=1) + line = re.sub("^\- ", "- ", line, count=1) + line = re.sub("^ ", " ", line, count=1) + line = re.sub(" ", " ", line) + line = re.sub("=3D", "=", line) + print(line, end="") + line = ""