procmail
[Top] [All Lists]

Re: Need pointers for HTML --> ASCII conversions

1998-06-25 13:17:05
On 25 June 1998, Timothy J Luoma
<luomat+Lists/Unix/procmail(_at_)luomat(_dot_)peak(_dot_)org> wrote:
"SR" == Stan Ryckman wrote:
SR> What do you need to do that "lynx -dump" doesn't do?

I need to be able to read from stdin

    Well, if that's the only thing holding you back, you can use a small
wrapper script that copies stdin to a temp file and feeds it to lynx:


        #!/bin/sh
        TMP_DIR=$HOME/tmp
        TMP_IN=$TMP_DIR/filter_in.$$.html
        TMP_OUT=$TMP_DIR/filter_out.$$
        umask 077
        cat >$TMP_IN
        lynx -dump $TMP_IN >$TMP_OUT
        cat $TMP_OUT
        trap "rm -f $TMP_IN $TMP_OUT; exit 0" 0 1 2 3 13 15


(the directory "tmp" in your $HOME should already exist, and, for
security reasons, it should have permissions set to 0700).

    But, if I understand your initial problem correctly, that would be
only half of the work.  IMO a much easier way to do what you want is to
leave the message alone, and use a MUA that can do that conversion for
you, such as Mutt:

        http://www.cs.hmc.edu/~me/mutt

Provided that you configure it correctly, Mutt can automatically invoke
"lynx -dump" for text/html attachments, and it can also create a decoded
copy of the message.

    Regards,

    Liviu

-- 
Dr. Liviu Daia                   e-mail:   daia(_at_)stoilow(_dot_)imar(_dot_)ro
Institute of Mathematics         web page: http://www.imar.ro/~daia
of the Romanian Academy          PGP key:  finger 
daia(_at_)stoilow(_dot_)imar(_dot_)ro