Twas brillig, on Fri Mar 12 at 06:55:29 PM, and Eric Smith burbled:

> some1 posted an interesting viewing facility for html with lynx
> Made me think of this for all those legacy file formats that ppl keep
> mailing like m$ .doc files.
> 
> for your .mailcap
> application/octet-stream; strings %s ;copiousoutput
> and for you .muttrc
> auto_view application/octet-stream
> 
> I tried to pipe it thru the handy mswordview that converts to html, and
> from there into lynx, but could not get a stream instead of a file from
> mswordview and besides its supper time now.

I use:

text/html;      lynx -dump %s; copiousoutput; nametemplate=%s.html
text/enriched;      /home/binde/bin/rtfreader %s; copiousoutput
application/msword;   /home/binde/bin/mswordview %s -o - | 
/home/binde/script/html2ascii; lynx %s; copiousoutput

html2ascii is:

#!/bin/sh
#
# Name: html2ascii
#
# Description:
#   Convert HTML files to ascii.  Makes empty lines empty.
#
# Exit Values:
#   0 Successful completion.
#   1 
#
# Inputs:
#   0 or more files (stdin is read for 0 files)
#
# Outputs:
#
# Environment:
#   DEBUG is list of scripts to debug
#   DEBUG_log is log file for debugging output
#
# Modified by:
#   11/01/95 Howard Fear            Original
#
# Notes:
#   01/01/96 Howard Fear            Change LYNX to be correct on your system.
#
LYNX=/usr/local/bin/lynx
 
set -h       # remember functions
self="`basename $0`"
die () { echo ${1:+"$self: $*"} >&2; kill -TERM $$; }
warn () { echo ${1:+"$self: $*"} >&2; }
usage () { echo "usage: $self files..." >&2; exit 1; }
: ${TMPDIR:=/tmp}
 
trap 'rm core >/dev/null 2>&1; exit 1' 0 15
case ":${DEBUG:=$debug}:" in
  *:$self:* | :all: | :true: | :on: )
    set -vx
    test "$DEBUG_LOG" && exec 2>>$DEBUG_LOG
    ;;
esac
 
# use stdin if no files present 
test $# -eq 0 && set -- -
for i
do
    case "$i" in
    - ) # process stdin
        # lynx occasionally core dumps so we remove core as well
        trap "rm $TMPDIR/$$.html core >/dev/null 2>&1" 0 15
        touch $TMPDIR/$$.html || {
            warn "Could not create $TMPDIR/$$.html"
            continue
        }
        while read line; do echo "$line" >> $TMPDIR/$$.html; done
        filename="$TMPDIR/$$.html"
        ;;
    * ) filename="$i" ;;
    esac
    ( $LYNX -dump $filename || die "Could not index file $filename" ) \
            | sed -e 's/[   ]*$//' 
    echo
done
 
exit 0




--
Melissa Binde  --  [EMAIL PROTECTED]
Outside the Asylum  --  http://www.terindell.com/
------------------------------------------------------------------------------
"Would you tell me, please, which way I ought to go from here?"
"That depends a great deal on where you want to get to," said the Cat.
                -- Lewis Carroll 

Reply via email to