Re: Thanks for: Still fighting to get clickable URLs via w3m

2002-05-23 Thread Marco Fioretti

On Wed, May 22, 2002 10:36:54 at 10:36:54AM +1000, Cameron Simpson wrote:
 On 23:46 21 May 2002, Marco Fioretti [EMAIL PROTECTED] wrote:
 | Thanks a lot to Gary Johnson and all the others who helped me to do
 | what said in the subject. It works OK!
 
 Care to summarise what scheme you finally ended up with for us? Thanks,
 -- 

I had already planned it. As a matter of fact, the original purpose of
all this nagging here and on the w3m list was to put together a series
of scripts and rc files for the email subsystem of the RULE project
(www.rule-project.org). After I got started, I also ended up writing
an article on the side, but the final scripts/rc files, with
explanations (and, of course, credits!) will be all put online on that
site sometime next week.

Ciao,
Marco Fioretti
-- 
Never let your sense of morals prevent you from doing what is right
Salvor Hardin , Foundation



Re: Thanks for: Still fighting to get clickable URLs via w3m

2002-05-21 Thread Cameron Simpson

On 23:46 21 May 2002, Marco Fioretti [EMAIL PROTECTED] wrote:
| Thanks a lot to Gary Johnson and all the others who helped me to do
| what said in the subject. It works OK!

Care to summarise what scheme you finally ended up with for us? Thanks,
-- 
Cameron Simpson, DoD#743[EMAIL PROTECTED]http://www.zip.com.au/~cs/

Sure, Len, just because something is old doesn't mean it's engraved in
stone.  We know a lot more about entertainment now than they did back
then.  Look at Lawrence Olivier!  You think he was in any of
Shakespeare's original productions?  No!  They added him years later!



Re: Still fighting to get clickable URLs via w3m

2002-05-21 Thread Cameron Simpson

On 12:14 20 May 2002, Flavien [EMAIL PROTECTED] wrote:
| Cameron Simpson wrote :
|  How about this script:
|  detab ${1+$@} \
|  | sed 's|\([Aa] [^]*[Hh][Rr][Ee][Ff]=\([^ 
|]*\)[^]*\)\(.*\)\(/[Aa]\)|\1\3 [ \2 ]\4|g' \
|  | w3m -dump -T text/html
| 
| sed has case Insensitive option : 'i', thus you don't need all the
| [Hh][Rr][Ee][Ff] thing. You can write it this way :
| sed 's|\(A [^]*HREF=\([^ ]*\)[^]*\)\(.*\)\(/A\)|\1\3 [ \2 ]\4|gi'

No. _GNU_ sed has that option. I use more varied systems than GNU based UNIX
variants and write portable sed scripts, not GNU specific dialects.
--
Cameron Simpson, DoD#743[EMAIL PROTECTED]http://www.zip.com.au/~cs/

My venus fly trap is higher up the food chain than I am.
- [EMAIL PROTECTED] (Simon Klyne)



Re: Still fighting to get clickable URLs via w3m

2002-05-20 Thread Flavien

Cameron Simpson wrote :
 How about this script:
 
   detab ${1+$@} \
   | sed 's|\([Aa] [^]*[Hh][Rr][Ee][Ff]=\([^ 
]*\)[^]*\)\(.*\)\(/[Aa]\)|\1\3 [ \2 ]\4|g' \
   | w3m -dump -T text/html

sed has case Insensitive option : 'i', thus you don't need all the
[Hh][Rr][Ee][Ff] thing. You can write it this way :
sed 's|\(A [^]*HREF=\([^ ]*\)[^]*\)\(.*\)\(/A\)|\1\3 [ \2 ]\4|gi'

(didn't check the rest of the regexp)

Flavien.
-- 
Linux!  Guerrilla UNIX Development Venimus, Vidimus, Dolavimus.
-- Mark A. Horton KA4YBR, [EMAIL PROTECTED]



Re: Still fighting to get clickable URLs via w3m

2002-05-16 Thread Cameron Simpson

On 14:38 13 May 2002, Marco Fioretti [EMAIL PROTECTED] wrote:
|  I do my terminal work in a gnome terminal.  This has the advantage of
|  recognizing urls triggered by mouse over.  To launch a browser, either
|  right click for the context sensitive menu or hold alt and left click.
| 
| I know, but this doesn't work with Hidden URLS, does it? (See my
|  original example) That is why I was hoping to get w3m working, because
| it *displays* plain, well formatted ASCII, but *knows* which strings
| correspond to other hidden strings which are URLs. Would the gnome
| terminal open the right URL if given the to know more click HERE
| string?

Hmm. It would be nice if w3m would recite URLs inline as an option, but it
doesn't. How about this script:

detab ${1+$@} \
| sed 's|\([Aa] [^]*[Hh][Rr][Ee][Ff]=\([^ 
]*\)[^]*\)\(.*\)\(/[Aa]\)|\1\3 [ \2 ]\4|g' \
| w3m -dump -T text/html

I'm about to start using it for HTML filtering in place of plain w3m.
It hacks the HTML to turn:

A HREF=urlfoo/A

into:
A HREF=urlfoo [ url ]/A

which shows up nicely. It doesn't resolve relative URLs, but HTML email shoudn't
have any, not having a useful baseurl. This script is available here:

http://www.zip.com.au/~cs/scripts/unhtml

for use in your mailcap like so:

text/html; unhtml %s; copiousoutput

It seems to work fairly well here.
What say you?
-- 
Cameron Simpson, DoD#743[EMAIL PROTECTED]http://www.zip.com.au/~cs/

If the Earth is the size of a pea in New York, then the Sun is a beachball 50m
away, Pluto is 2km away, and the next nearest star is in Tokyo.  Now shrink
Pluto's orbit into a coffee cup; then our Milky Way Galaxy fills North America.



Still fighting to get clickable URLs via w3m

2002-05-13 Thread Marco Fioretti

Hello,

I haven't been able yet to use w3m (or any other text browser for that matter) work 
cleanly as a Mutt pager. I want to read HTML email as text,
but with text corresponding to hyperlinks active so that clicking it,
or with some keystroke, I can open an external browser directly on the
underlying URL, like this:

HTML body source:
.A HREF=http://www.google.com;GOOGLE!/A.

View in mutt pager:
.GOOGLE!.

and selecting/clicking/highligthing/whatever the GOOGLE! string starts
an external browser on www.google.com

As already pointed out here, the remaining problem is that w3m is started on the whole 
message, headers and all, so even if URLs are recognized when pressing : the whole 
thing is quite a mess to read.

Any suggestion? I have just discovered the set_pipe_decode options, but
am not sure they have anything to do with my problem


TIA,
Marco Fioretti




Re: Still fighting to get clickable URLs via w3m

2002-05-13 Thread John P Verel


On 05/13/02, 01:33:16PM +0200, Marco Fioretti wrote:
 Hello,
 
 I haven't been able yet to use w3m (or any other text browser for that matter) work 
cleanly as a Mutt pager. I want to read HTML email as text

Marco,


This works for me:

I do my terminal work in a gnome terminal.  This has the advantage of
recognizing urls triggered by mouse over.  To launch a browser, either
right click for the context sensitive menu or hold alt and left click.

My ~/.mailcap entry for w3m looks like this:

text/html; w3m -T text/html -dump %s; copiousoutput; print= w3m -T text/html -dump %s 
| a2ps -c --borders=no --margin=36 --center-title=

Note that this also allows me to print via a2ps, if desired.

HTH.

John
-- 
John P. Verel
Living Proof That Low Tech Beats High Tech!



Re: Still fighting to get clickable URLs via w3m

2002-05-13 Thread Marco Fioretti


 Marco,


 This works for me:

 I do my terminal work in a gnome terminal.  This has the advantage of
 recognizing urls triggered by mouse over.  To launch a browser, either
 right click for the context sensitive menu or hold alt and left click.


I know, but this doesn't work with Hidden URLS, does it? (See my
 original example) That is why I was hoping to get w3m working, because
it *displays* plain, well formatted ASCII, but *knows* which strings
correspond to other hidden strings which are URLs. Would the gnome
terminal open the right URL if given the to know more click HERE
string?

Again, I started looking after this because from Gary Johnson Mutt Page
and previous postings here, it seems something that would surely work:
did I miss something?

TIA,
Marco Fioretti




Re: Still fighting to get clickable URLs via w3m

2002-05-13 Thread Gary Johnson

On Mon, May 13, 2002 at 02:38:17PM +0200, Marco Fioretti wrote:
  Marco,
  
  
  This works for me:
  
  I do my terminal work in a gnome terminal.  This has the advantage of
  recognizing urls triggered by mouse over.  To launch a browser, either
  right click for the context sensitive menu or hold alt and left click.
  
 
 I know, but this doesn't work with Hidden URLS, does it? (See my
  original example) That is why I was hoping to get w3m working, because
 it *displays* plain, well formatted ASCII, but *knows* which strings
 correspond to other hidden strings which are URLs. Would the gnome
 terminal open the right URL if given the to know more click HERE
 string?
 
 Again, I started looking after this because from Gary Johnson Mutt Page
 and previous postings here, it seems something that would surely work:
 did I miss something?

No, you didn't miss anything.  There's never been a demand for that
feature by mutt users, so no one that I know of has ever addressed it.
I receive very little e-mail that is both formatted as HTML and contains
links that I have any interest in following.  When I do receive such
e-mail and want to see it as HTML, I use the attachment menu.

I played around with this a little and came up with the following
solution.  It may have some bugs, but it's at least a starting point.
First of all, you want to have mutt send HTML messages as raw HTML to
your pager.  The way I did this was to put this in my muttrc:

auto_view text/html

and this in my mailcap:

text/html; w3m %s; nametemplate=%s.html
text/html; cat; copiousoutput

Next, you want to specify a pager that understands that the header is
plain text but the body is HTML.  I wrote a shell script and called it
'htmlviewer':

#!/bin/sh
sed '1i\
html\
head\
title/title\
/head\
body\
pre
s|^\[-- Autoview using .*|/pre\
/body\
/html|
' $* | w3m -T text/html

It wraps the header in an HTML block and deletes the [-- Autoview line
before sending the message to w3m.  Then I just set

pager=htmlviewer

in my muttrc.  You will probably want to use a display-hook (or
message-hook) for this.

That was kind of terse--I hope it was clear.  Is that closer to what you
want?

HTH,
Gary

-- 
Gary Johnson   | Agilent Technologies
[EMAIL PROTECTED]   | Spokane, Washington, USA
http://www.spocom.com/users/gjohnson/mutt/ |