aboutsummaryrefslogtreecommitdiff
path: root/bin/display_filter.sh
blob: e45bf026d9a302fdbf5d5c7323d57f85f9a1facf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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}'