[Top] [All Lists]

Re: [nmh-workers] Formatting HTML to Text: netrik.

2019-06-29 23:16:23
In message <20190628144427.4845F70031@pb-smtp20.pobox.com>, 
Ken Hornstein <kenh@pobox.com> wrote:

Ok, these things are not hard.

Speak for yourself!  My little pea brain is still trying to grok all this.

First, delete the entries for showproc and showmimeproc; the defaults
for these programs are fine (they are, respectively, mhl and mhshow; you
can look at mh-profile(5) for the exact defaults).

My man page sez the defaults are:
      showmimeproc: /usr/local/bin/mhshow
       showproc: /usr/local/libexec/nmh/mhl

Hope those are right!

Secondly, I see that in your profile you have:

      mhshow-show-text/html: more '%F'

Which isn't helping things, so delete that also.


I don't know if the
package for nmh on FreeBSD sets things up correctly, but if you look
at mhn.defaults (which should be in the 'etc' directory somewhere) you
might see a line that looks like:

mhshow-show-text/html: charset=3D%{charset}; %lw3m -dump ${charset:+-I "$c=
harset"} -T text/html %F

I have *no* line in /usr/local/etc/nmh/mhn.defaults file that begins with
or even contains the literal string "mhshow-show-text/html".  So I have tried
to add what you posted to my test account ~/.mh_profile file, but the
line you sent got garbled in transmission because your posting was:

    Content-Transfer-Encoding: quoted-printable

I have tried my best to infer what you wrore. Please check and tell me if
this is exactly correct:


If you DON'T, then you could add that to your profile


(assuming you are using w3m)

I wasn't.  In faact I never even heard of the thing before now.

But fortunately, there is a port/package of that for FreeBSD and I have
just installed it.

and that should make 'show' mostly do the right thing.

Mostly, it looks OK, but I keep on getting stuff like this at the top:

   [ part 1 - text/html -   1.3KB  ]

I actually kind of like that.  i just hope that it won't show up when
I go to to "repl".

I also see you have:

      mhshow-charset-iso-8859-1: %s

I'd delete that


also (we have native support for iconv).  And just as a
matter of future-proofing, I'd recommend using a UTF-8 locale if you aren't

How would I know, one way or the other?

Here is what I have set.  is this what you are talking about?  Or do I
need to fiddle sonmething else entirely?

    % env | fgrep LOCALE

Now, for showing full headers ... this is also not hard...

Wait!  Looking at some messages in my test account, where I have already
made all of the changes suggested above, it appears that I *am* seeing
the full headers already when I just do "show".  I am quite certainly
seeing all of the following header types (which is good):


It sure looks to me like *all* header types are *already* being displayed
when I just do "show", so why are you thinking that I need ot do something
additional in order to see the full headers?

(The only problem is that the headers, as they are displayed with "show",
appear to have has some extra whitespace inserted... by *something*... just
after the colons in each case.  How do I shut THAT off?)

.but what you need
to do isn't obvious because things are kinda spread out.  The program by
default that handles message display is mhl, so you could should read...

I'm going to leave all this for now, since I already seem to be getting
full headers.

... So to get full headers for
MIME messages you need to modify the mhl format used by mhshow to
display the headers; the default one is mhl.headers, and I believe that
again what you need to do is simply delete the 'ignores' line.

Ummmm... Here is the /usr/local/etc/nmh/mhl.headers fle that is these
days being distributed & installed with nmh itself for FreeBSD:


I'm not seeing any "ignore" lines in there.  So maybe, in my case, this
whole issue has been "pre-fixed" to my liking already (?)

Ohhhhhhh!  Wait!  in the Mail/ directory of my "test" account it seems
that I already had a file called "mhl.headers" in there, and I guess
that is overriding the system default.  Here is the Mail/mhl.headers
that's already in my test account.  (Is this really no good?  Seems
perfectly servicable to me!)


Well, so I deleted the Mail/mhl.headers file for my test account
and did a "show" again on one piece of old spam that had been received
back in Feb. and this is what that looks like now when I do "show":


This seems fairly messed up to me.  I understand that the default systemwide
mhl.headers file is (somehow) preventing me from seeing the Received: headers,
but even ignoring that small fly in the ointment, why the bleep am I now
getting (what I assume are) the "important" headers, shown at the top,
followed by a blank line and then a bunch of *other* header lines?  Is
that really the effect that the default mhl.headers file is *supposed*
to produce??

Now on to repl...

 See the comments at the top of replyfilter for usage information; it
 will likely require some adjustment for your site.

I don't follow.  What will need adjusting, exactly?

Well, I could improve the documentation there as well.  Specifically
you might need to change $filterprogram, $outcharset, and @htmlconv.

OK, so I put a copy of the distribted replyfilter Perl script into
/usr/local/bin/ and I edited just one line, which was the definition
of $filterprogram:

    $filterprogram = 'fmt';

(Apparently, "fmt" is what I have by default on my FreeBSD system.)

I left those other two variable with the definitions they already had:

   $outcharset = 'utf-8';
   @htmlconv = ('w3m', '-dump', '-cols', $maxcolwidth - 2, '-T', 'text/html',
             '-O', $outcharset, '-I');

I think that will be OK, because I think that I have my xterm windows set
to permit/support UTF-8.  (But how can I check this to be sure?)

Anyway, this is most definitely NOT working.  Look at this, which I cut
and pasted from my xterm window when I tried to do a repl:


I don't think that this is or was the intended effect.

So, anyway, I think we have the tools to make things much better for you.

I'm still hoping that is the case, but it isn't looking good so far.

I hope that you can guide me on how to debug these issues.  (I'm sure that
it would help a lot if I actually knew what the hell I was doing, but I am
hoping that together we can struggle along and find solutions even in the
absence of that.)

Hopefully in the future it will all be mostly-automatic.  If you run into
problems, please let us know here.

You betcha!  Consider it done!



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