W |readwebpost %C Mosaic\nThis will mean if you see a news article with a URL or HTML tags in it, you can just type W and it will automatically tell your (already running) Mosaic to jump to a htmlified version of the article you are reading. If you prefer to use lynx over Mosaic, change the above line to:
W |readwebpost %C lynx\nThen, all you need to do is include the program readwebpost in your path somewhere. (On Athena, this means in the directory ~/$bindir for each platform, or add mkgray). The program follows at the bottom of this page. Note, if you are not at MIT, you need to change the first line to the path for perl on your system.
What this program does is add html tags to the news article. It tries to do smart things, and usually it formats the article nicely, but every now and then it gets confused. Most important though, it renders any html in the article and makes links from all URLs. If you don't want it to try to do any fancy formatting, change the line in .rnmac to something like:
W |readwebpost %C Mosaic plain\nAnd it will only render any html tags included in the article already.
Matthew Gray <mkgray@mit.edu>
\n";
$inheader = 0;
}
if($inheader){
/([^:]+): (.+)/;
if($1 eq "From" || $1 eq "Subject"){
s/([^:]+): (.+)/\1<\/strong>: \2<\/em>
/;
}
else{
$_.="
" if $_;
}
}
if(substr($_,0,2) eq "--"){
$line = "
\n";
$line .= substr($_,2) if (substr($_,2) =~ /[a-zA-Z]/);
$line .= "";
$insig = 1;
}
$line = $_ unless $line;
$post .= $line;
}
if($insig){
$post .= "
";
}
}
else{
$post = "$post
";
}
$post=~s,([^="])(http://(\S+)),\1\2,g;
$post=~s,([^="])(ftp://(\S+)),\1\2,g;
$post=~s,([^="])(file://(\S+)),\1\2,g;
$post=~s,([^="])(gopher://(\S+)),\1\2,g;
open(ART, ">/tmp/article.html");
print(ART $post);
close(ART);
if($mode eq "lynx"){
if($pid = fork()){
wait; #
unlink("/tmp/article.html");
}
else{
system("lynx /tmp/article.html < /dev/tty");
}
}
else{
$ps = (-e '/usr/ucb/ps') ? '/usr/ucb/ps ax':'ps ax';
$out = `$ps`;
$out =~ /[ \t]*(\d+).+Mosaic.*/;
$mospid = $1;
open(TMP, ">/tmp/Mosaic.$mospid");
print(TMP "goto\n");
print(TMP "file://localhost/tmp/article.html\n");
close(TMP);
kill 'USR1', $mospid;
exit;
}