# HG changeset patch # User Meredith Howard # Date 1494020209 14400 # Node ID 81f1da7a57e1d9e9900a1f55b57ed6fbf95a5cdf # Parent c1949730cc7412b3c9a0e6d0012eb1e6fe71493b move html dump stuff into one file and customize diff --git a/.mutt/mailcap b/.mutt/mailcap --- a/.mutt/mailcap +++ b/.mutt/mailcap @@ -1,2 +1,2 @@ # text/html; pandoc -S -t markdown-raw_html %s; copiousoutput; description=HTML Part; nametemplate=%s.html -text/html; links -dump %s; copiousoutput; description=HTML Part; nametemplate=%s.html +text/html; mutt-html2txt %s; copiousoutput; description=HTML Part; nametemplate=%s.html diff --git a/.vimrc b/.vimrc --- a/.vimrc +++ b/.vimrc @@ -498,8 +498,7 @@ let g:neocomplcache_filename_include_exp " {{{ Commands " Preview markdown mail -- I edit with headers so I box them in a code block. -command! MailPreview enew | set bt=nofile | 0r # | exe 'norm 0O```}O```' | silent exe '%!mutt-md2html > #.~htm~' - \ | silent exe '0r !links -dump #.~htm~' | silent exe '!rm -f #.~htm~' | 0 +command! MailPreview enew | set bt=nofile | 0r # | exe 'norm 0O```}O```' | silent exe '%!mutt-md2html | mutt-html2txt' | 0 command! MailPreviewHTML enew | set bt=nofile | 0r # | exe 'norm 0O```}O```' | silent exe '%!mutt-md2html' | 0 if !exists(":DiffOrig") diff --git a/bin/mutt-html2txt b/bin/mutt-html2txt new file mode 100755 --- /dev/null +++ b/bin/mutt-html2txt @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +LINKS="links -html-tables 0 -html-image-names 0 -html-margin 0" +FILE=${1:--} + +[ "$FILE" != '-' ] && + exec $LINKS -dump $FILE + +TMPHTML="$(mktemp).html" +cat > $TMPHTML +$LINKS -dump $TMPHTML +rm -f $TMPHTML