Nail viewing HTML messages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Nail viewing HTML messages

Jon Fineman
I am having trouble viewing an HTML message. Nail natively seems to work with
simple HTML messages that I create and email to myself. However commercially
created emails with multi-part doesn't render in lynx.

I have nail version v14.9.15, 2019-08-17 (built for OpenBSD) and I am working
through the example in the man page below (without the ? marks). The second
part viewing PDFs works fine. The first part to view a fancy HTML doesn't work.
I installed lynx. I think the issue is with mathml which I don't quite
understand what that is doing with regard to the first part of defining a pipe
to lynx. I don't see anything related to mathml in the packages.

When I view an HTML message with the "p" command it views the text displayable
version, as expected. When I use the mimeview command it just displays a blank
or two of lines and no text.


? if [ "$features" !% +filter-html-tagsoup ]
?   #set pipe-text/html='?* elinks -force-html -dump 1'
?   set pipe-text/html='?* lynx -stdin -dump -force_html'
?   # Display HTML as plain text instead
?   #set pipe-text/html=?
? endif
? mimetype ? application/mathml+xml mathml
? wysh set pipe-application/pdf='?&=? \
    trap "rm -f \"${MAILX_FILENAME_TEMPORARY}\"" EXIT;\
    trap "trap \"\" INT QUIT TERM; exit 1" INT QUIT TERM;\
    mupdf "${MAILX_FILENAME_TEMPORARY}"'

Am I misunderstanding how this macro works?

Thanks.

Jon

Reply | Threaded
Open this post in threaded view
|

Re: Nail viewing HTML messages

Steffen Nurpmeso-2
Hello.

Jon Fineman wrote in <20191224111506.MXV_O%[hidden email]>:
 |I am having trouble viewing an HTML message. Nail natively seems to \
 |work with
 |simple HTML messages that I create and email to myself. However commerci\
 |ally
 |created emails with multi-part doesn't render in lynx.

Hmm, whether i use the simple builtin HTML viewer, or the better
lynx, it works for me?

 |I have nail version v14.9.15, 2019-08-17 (built for OpenBSD) and I \
 |am working
 |through the example in the man page below (without the ? marks). The second
 |part viewing PDFs works fine. The first part to view a fancy HTML doesn't \
 |work.

 |I installed lynx. I think the issue is with mathml which I don't quite
 |understand what that is doing with regard to the first part of defining \
 |a pipe
 |to lynx. I don't see anything related to mathml in the packages.

That mathml thing is really only an example of how a new MIME type
can be created from within the application itself, without some
mime.types(5) on the system.

 |When I view an HTML message with the "p" command it views the text \
 |displayable
 |version, as expected. When I use the mimeview command it just displays \
 |a blank
 |or two of lines and no text.

The mimeview command is for now only "a crux" to be able to access
those MIME parts which cannot be displayed inline alongside other
MIME parts.  Or, in ~/.mailcap terms, those MIME parts which are
not "copiousoutput" enabled.  When using the mimeview command on
So

 |? if [ "$features" !% +filter-html-tagsoup ]
 |?   #set pipe-text/html='?* elinks -force-html -dump 1'
 |?   set pipe-text/html='?* lynx -stdin -dump -force_html'
 |?   # Display HTML as plain text instead
 |?   #set pipe-text/html=?
 |? endif

  if "$features" !% +filter-html-tagsoup

So if the builtin simple HTML filter is not available (% is
substring match, case sensitively, =% and !%, as opposed to == and
!= which are an exakt match, just like in the shell)

    set pipe-text/html='?* lynx -stdin -dump -force_html'

Then install lynx has a HTML viewer.  The "?*" tells S-nail that
this is "copiousoutput" in .mailcap terms, that is, the output
that lynx produces can be reintegrated in the normal output that
S-nail produces, and thus ends in less(1) (likely), or directly on
the terminal (depending on the setting of "crt", how many lines
the terminal height is, and how large the final output).

  endif
 mimetype ? application/mathml+xml mathml

Register a new MIME type.  The ? is again a modifier, an extension
tag, it tells S-nail that it should treat MIME parts of this type
as plain text by default, if no explicit handler is available.

 |? wysh set pipe-application/pdf='?&=? \
 |    trap "rm -f \"${MAILX_FILENAME_TEMPORARY}\"" EXIT;\
 |    trap "trap \"\" INT QUIT TERM; exit 1" INT QUIT TERM;\
 |    mupdf "${MAILX_FILENAME_TEMPORARY}"'
 |
 |Am I misunderstanding how this macro works?

Well "mimeview" is for now really only a crux.  In the original
code any MIME part which has a handler installed was simply being
executes when the mail has been viewed (via "t"ype
a.k.a. "p"rint), which was really a bad thing.  So now the view
command only prints what can be viewed directly and on the
terminal, and as a whole; S-nail prepares that output, and sends
it to the $PAGER as necessary.  All other MIME types, like PDF in
the thing above, have to go over mimeview, and mimeview will ask
you for each part in turn whether you want to have the handler
invoked.  The above PDF handler for example will run
asynchronously in the background, with a temporary file being
filled in.

It is very primitive yet, it would be much nicer if you could
address MIME parts directly, as in "mimeview 13.2", and we would
also need a MIME parts overview display, like we now have
a "headers" overview display, as in "mimetree" or whatever.
Then, with the right key "bind"ings you could use the cursor keys
to move up and down and maybe have one to invoke a mimeview which
invokes the handler for the part the cursor is over.  But that not
yet.

 |Thanks.

I hope this helps, a nice rest-Christmas and
Ciao from Germany,

 |Jon
 --End of <20191224111506.MXV_O%[hidden email]>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)