aboutsummaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-27 09:32:46 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-27 09:32:46 -0400
commit177651bddab145c8a56cdfeb0d57b5fd95a6d0e2 (patch)
tree75681e3ab5c71b8cdb06f22247dfcd4a547393dc /filters
parent59df06fe28ddde3607cb3080636e65d48b762baf (diff)
Move contrib -> filters
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/hldiff39
-rwxr-xr-xfilters/html10
-rwxr-xr-xfilters/plaintext13
3 files changed, 62 insertions, 0 deletions
diff --git a/filters/hldiff b/filters/hldiff
new file mode 100755
index 0000000..b672e21
--- /dev/null
+++ b/filters/hldiff
@@ -0,0 +1,39 @@
+# vim: set ft=awk :
+BEGIN {
+ bright = "\x1B[1m"
+ red = "\x1B[31m"
+ green = "\x1B[32m"
+ cyan = "\x1B[36m"
+ reset = "\x1B[0m"
+
+ hit_diff = 0
+}
+{
+ if (hit_diff == 0) {
+ if ($0 ~ /^diff /) {
+ hit_diff = 1;
+ print bright $0 reset
+ } else if ($0 ~ /^.*\|.*(\+|-)/) {
+ left = substr($0, 0, index($0, "|")-1)
+ right = substr($0, index($0, "|"))
+ gsub(/-+/, red "&" reset, right)
+ gsub(/\++/, green "&" reset, right)
+ print left right
+ } else {
+ print $0
+ }
+ } else {
+ if ($0 ~ /^-/) {
+ print red $0 reset
+ } else if ($0 ~ /^+/) {
+ print green $0 reset
+ } else if ($0 ~ /^ /) {
+ print $0
+ } else if ($0 ~ /^@@ (-[0-9]+,[0-9]+ \+[0-9]+,[0-9]+) @@.*/) {
+ sub(/^@@ (-[0-9]+,[0-9]+ \+[0-9]+,[0-9]+) @@/, cyan "&" reset)
+ print $0
+ } else {
+ print bright $0 reset
+ }
+ }
+}
diff --git a/filters/html b/filters/html
new file mode 100755
index 0000000..db7808a
--- /dev/null
+++ b/filters/html
@@ -0,0 +1,10 @@
+#!/bin/sh
+# aerc filter which runs w3m using socksify (from the dante package) to prevent
+# any phoning home by rendered emails
+export SOCKS_SERVER="127.0.0.1:1"
+exec socksify w3m \
+ -T text/html \
+ -cols $(tput cols) \
+ -dump \
+ -o display_image=false \
+ -o display_link_number=true
diff --git a/filters/plaintext b/filters/plaintext
new file mode 100755
index 0000000..71e33f7
--- /dev/null
+++ b/filters/plaintext
@@ -0,0 +1,13 @@
+# vim: set ft=awk :
+BEGIN {
+ dim = "\x1B[2m"
+ cyan = "\x1B[36m"
+ reset = "\x1B[0m"
+}
+{
+ if ($0 ~ /^On .*, .* wrote:/ || $0 ~ /^>+/) {
+ print dim cyan $0 reset
+ } else {
+ print $0
+ }
+}