aboutsummaryrefslogtreecommitdiff
path: root/bin/display_filter.sh
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-10 18:48:35 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-10 18:48:35 +0200
commit4d4c0e81a0caace3dc035ff9010ee01ac162ec86 (patch)
tree42d045bcd2d003ebd30caf7c7d642e03002de35c /bin/display_filter.sh
downloadneomutt-4d4c0e81a0caace3dc035ff9010ee01ac162ec86.tar.gz
neomutt-4d4c0e81a0caace3dc035ff9010ee01ac162ec86.tar.bz2
neomutt-4d4c0e81a0caace3dc035ff9010ee01ac162ec86.zip
update
Diffstat (limited to 'bin/display_filter.sh')
-rwxr-xr-xbin/display_filter.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/display_filter.sh b/bin/display_filter.sh
new file mode 100755
index 0000000..e45bf02
--- /dev/null
+++ b/bin/display_filter.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# lun. 29 mars 2021 09:05:05 CEST
+# Neomutt display_filter.sh
+# filter for pager display only
+
+sed -e '
+
+# clean up neomutt notifications
+/\[-- Visualisation.* --\]/d
+/\[-- Type: text.* --\]/d
+/\[-- Type.* --\]/d
+/\[-- Pièce jointe #[0-9] --\]/d
+s/Pièce jointe #[0-9]: //g
+/\[-- .* pas disponible .* --\]/d
+
+# url tidy
+# put each url on a new line
+s/http/\nhttp/g
+# replace last /blahblah with /...
+#s|\(http.*\)/.*|\1\/...|
+
+# hide messy inline pdf
+/^%PDF-1.4/,/^%%EOF/d
+
+# add newline after --]
+s/--\]/--\]\n/g
+
+# CID
+s/\[cid/\n\[cid/g
+
+# delete [img] tags
+s/\[img\]//g
+
+# change ugly lines
+s/━/-/g
+
+# remove last <
+s/<*$//
+
+# remove lone [
+s/^\[$//
+
+# delete single spaces at the beginning of lines
+s/^ //g
+
+# delete multiple spaces
+s/[[:space:]]\+/ /g
+
+# delete multiple blank lines
+
+' | awk '!NF {if (++n <= 1) print; next}; {n=0;print}'
+
+