From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6896869160505049088 X-Gmail-Labels: Topic type: DISCUSSION Date: Thu, 26 Nov 2020 16:46:08 -0800 (PST) From: Robert Winkler To: The Sup email client Message-Id: <977f8e8e-6552-4d09-beba-511c30d6e2ccn@googlegroups.com> In-Reply-To: <1606429457-sup-1721@ceres> References: <316fbc8c-fb9b-47c5-946e-5f6a7b6730e5n@googlegroups.com> <1606429457-sup-1721@ceres> Subject: Re: [sup] Inline view of HTML emails MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1574_1242250122.1606437968467" ------=_Part_1574_1242250122.1606437968467 Content-Type: multipart/alternative; boundary="----=_Part_1575_1285479322.1606437968467" ------=_Part_1575_1285479322.1606437968467 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Iain, Thanks again! I added the following code require 'shellwords' unless sibling_types.member? "text/plain" case content_type when "text/html" `/usr/bin/w3m -dump -T #{content_type} #{Shellwords.escape filename}` end end in a new hook ~/.sup/hooks/mime-decode.rb Let's see how it works. Best regards, Robert On Thursday, 26 November 2020 at 16:31:09 UTC-6 ipv2...@parris.org wrote: > Hi Robert, > > Excerpts from Robert Winkler's message of 2020-11-19 08:14:45 -0800: > > many people send their mails in HTML format only. Currently, I open them > > in an external browser. But seeing them inline would be nice. > > Is there a way how to do this? > > A mime-decode hook could accomplish this. > > See: > < > https://github.com/sup-heliotrope/sup/wiki/Viewing-Attachments#decoding-attachments > >. > > You would need w3m installed, and to create the file > ~/.sup/hooks/mime-decode.rb containing contents as above. > > Another alternative (but which wouldn't display the HTML inline) is to > create a mailcap file ~/.mailcap containing: > > text/html; /usr/bin/w3m -T text/html %s; needsterminal; description=HTML > Text; nametemplate=%s.html > > With this alternative, pressing enter on a .html file would display it > in w3m, instead of launching a desktop GUI browser. > > Kind regards, > Iain > ------=_Part_1575_1285479322.1606437968467 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Hi Iain,

Thanks again! I added the following code

require 'shellwords' 
unless sibling_types.member? "text/plain" 
    case content_type 
    when "text/html" 
        `/usr/bin/w3m -dump -T #{content_type} #{Shellwords.escape filename}` 
    end 
end

in a new hook ~/.sup/hooks/mime-decode.rb

Let's see how it works.

Best regards, 
Robert

On Thursday, 26 November 2020 at 16:31:09 UTC-6 ipv2...@parris.org wrote:
Hi Robert,

Excerpts from Robert Winkler's message of 2020-11-19 08:14:45 -0800:
> many people send their mails in HTML format only. Currently, I open them
> in an external browser. But seeing them inline would be nice.
> Is there a way how to do this?

A mime-decode hook could accomplish this.

See:
<https://github.com/sup-heliotrope/sup/wiki/Viewing-Attachments#decoding-attachments>.

You would need w3m installed, and to create the file
~/.sup/hooks/mime-decode.rb containing contents as above.

Another alternative (but which wouldn't display the HTML inline) is to
create a mailcap file ~/.mailcap containing:

text/html; /usr/bin/w3m -T text/html %s; needsterminal; description=HTML Text; nametemplate=%s.html

With this alternative, pressing enter on a .html file would display it
in w3m, instead of launching a desktop GUI browser.

Kind regards,
Iain
------=_Part_1575_1285479322.1606437968467-- ------=_Part_1574_1242250122.1606437968467--