unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Keith Packard <keithp@keithp.com>
To: Carl Worth <cworth@cworth.org>, Alex Ghitza <aghitza@gmail.com>,
	notmuch@notmuchmail.org
Subject: Re: viewing text/html (inline or otherwise)
Date: Tue, 09 Feb 2010 22:10:02 -0800	[thread overview]
Message-ID: <yuneiktmxj9.fsf@aiko.keithp.com> (raw)
In-Reply-To: <87iqa6lz1b.fsf@yoom.home.cworth.org>

[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth <cworth@cworth.org> wrote:

> I know that Keith is using a little script he wrote so that he can hit
> '|' on a message and pipe it to his script. The script then uses a
> utility, (munpack?) to extract all the various MIME parts to a temporary
> directory and then run a web broswer on that directory. Perhaps Keith
> would be so kind as to share that script with the community here.

It's not much of a script, I call it 'view-html'

#!/bin/sh
dir=`mktemp -d`
trap "rm -r $dir" 0
cat "$@" > "$dir"/msg
if munpack -C "$dir" -t < "$dir"/msg 2>&1 | grep 'Did not find'; then
    sed -n '/[Hh][Tt][Mm][Ll]/,$p' "$dir"/msg > $dir/part1.html
    rm "$dir"/msg
fi
for i in "$dir"/part*; do
    if grep -q -i -e '<html>' -e 'text/html' "$i"; then
	iceweasel "$i" &
	sleep 3
	exit 0
    fi
done

Note that if iceweasel isn't already running, it seems to shut down when
the script exits. I don't know why.

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

      parent reply	other threads:[~2010-02-10  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 10:28 viewing text/html (inline or otherwise) Alex Ghitza
2010-02-10  0:22 ` Carl Worth
2010-02-10  0:43   ` Alexander Botero-Lowry
2010-02-10  6:40     ` Alex Ghitza
2010-02-10  8:14     ` Sebastian Spaeth
2010-02-10  6:10   ` Keith Packard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yuneiktmxj9.fsf@aiko.keithp.com \
    --to=keithp@keithp.com \
    --cc=aghitza@gmail.com \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).