procmail
[Top] [All Lists]

Re: Lynx as an external viewer for pine

1997-01-28 08:18:18
On Tue, 28 Jan 1997, Robin S. Socha wrote:

uzs8kb> Someone suggested the following recipe for starting lynx as a
uzs8kb> filter for HTML messages (which pine cannot display): 
uzs8kb> 
uzs8kb> >:0 bf
uzs8kb> >* ^Content-type: text/html
uzs8kb> >| cat > /tmp/m$$.html ; lynx -dump /tmp/m$$.html ; rm /tmp/m$$.html
uzs8kb> >
uzs8kb> >This should take all messages containing a header line
uzs8kb> >starting, "Content-type: text/html" and pipe the body of the
uzs8kb> >message through the command given, which saves the body to a
uzs8kb> >file ("cat > /tmp/m$$.html"), uses Lynx to convert the HTML to
uzs8kb> >plain text ("lynx -dump /tmp/m$$.html"), then removes the old
uzs8kb> >body ("rm /tmp/m$$.html").  The output from Lynx is captured as
uzs8kb> >the new body of the message and processing of your
uzs8kb> >".procmailrc" continues.
uzs8kb> 
uzs8kb> Somehow, that doesn't seem to work. I've been toying around with
uzs8kb> it and suspect that at least the lynx -dump /tmp/m$$.html part
uzs8kb> is wrong, because I have to > the output to a file... 

I don't know how to strip the HTML to a file, but if you want to train
pine to view the HTML using lynx as you read the message, just add the
following to your .mailcap file:

text/html; lynx -force_html %s; \
        test=test -z "$LYNX_VERSION"; needsterminal

Note this is untested.  What I actually use is a more complicated form
that invokes Netscape if $DISPLAY is set, and lynx if it's not:

# HTML Support, courtesy Glenn A Malling 
<gmalling(_at_)mailbox(_dot_)syr(_dot_)edu>
# Try to use an existing netscape instantiation; if not, start one
text/html; netscape-sgi -remote "openFile(%s)" || netscape %s; \
        test=test -n "$DISPLAY" -a -z "$LYNX_VERSION"
# When display is not set and lynx isn't already running
# Don't know whether a URL can be passed to a running lynx instantiation
text/html; lynx -force_html %s; \
        test=test -z "$DISPLAY" -a -z "$LYNX_VERSION"; needsterminal

Hope it helps,
-- 
   Rick Troxel     Rick_Troxel(_at_)nih(_dot_)gov     
rick(_at_)helix(_dot_)nih(_dot_)gov
     http://www.dc-sage.org/bios/rick_troxel  301/435-2983
/////////////////////////////////////////////////////////////////
All effort and exertion put forth by man from the fullness of his
heart is worship, if it  is prompted  by the  highest motives and
the will to do service to humanity.                 --Abdu'l-Baha

<Prev in Thread] Current Thread [Next in Thread>