如何將網路論壇的文件以 HTML 的格式送到瀏覽器中呢?

要如何做將論壇中的文件送至瀏覽器中,這與您的系統有很大的關係; 如果您有一台麥金塔或是 Windows 系統,那麼答案可能完全不一樣。但 是這裡有一個簡單的 shell script 可以在 Unix 帳號下將張貼的文件由 rn 或 是相關的新聞討論群閱讀程式送至Lynx 程 式中。您可以將底下的文字放入一個叫做“ readwebpost “的檔案中, 並且使用“chmod“命令來讓它可以執行,然後將它放入您的路徑中的 任何位置(就像是您個人的 bin 目錄):
#!/bin/sh
echo \<PRE\> > .article.html 
cat >> .article.html 
echo \</PRE\> >> .article.html 
lynx .article.html  < /dev/tty
rm .article.html 
現在增加底下幾行到您的 .rnmac 檔(如果您還沒有這個檔,請建一個新的):
W     |readwebpost %C
現在當你用 rn 來閱讀新聞討論群時,你可以按下“W“,有一個訊息就會被 送到 Lynx ,而您原來的鏈結也還會留著。

Larry W. Virden 提供了底下的版本,它可以與 Mosaic 一起使用,並且具有與已 經在執行的 Mosaic 溝通的能力,而不需要再啟動另一個 Mosaic (您也可以使 用 rn macro 來作上面的事情,使用 "goto-xm" 而不是 "readwebpost")。您可以 詳細的閱讀底下程式中的說明,並且仔細的閱讀指令。

#! /bin/sh
# goto-xm, by Joseph T. Buck <jbuck@eecs.berkeley.edu>
# Modified heavily by Larry W. Virden <lvirden@cas.org>
# Script for use with newsreaders such as trn.  Piping the article
# through this command causes xmosaic to pop up, pointing to the
# article.  If an existing xmosaic (version 1.1 or later) exists,
# the USR1 method will be used to cause it to point to the correct
# article, otherwise a new one will be started.

# assumptions: ps command works as is on SunOS 4.1.x, may need changes
# on other platforms.

URL=`/bin/grep '^Message-ID:' | /bin/sed -e 's/.*</news:/' -e 's/>.*//'`
if [ "X$URL" = "X" ]; then
        echo "USAGE: $0 [goto] [once] < USENET_msg" >&2
        exit 1
fi

pid=`ps -xc | egrep '[Mm]osaic' | awk 'NR == 1 {print $1}'`
p=`which Mosaic`
gfile=/tmp/Mosaic.$pid

$p "$URL" &

if      [ "$#" -gt 0 ] ; then
  if    [ "$1" = "goto" -o "$1" = "same" ] ; then
        shift
        echo "goto"   > $gfile
  else
        echo "newwin" > $gfile
  fi
else
        echo "newwin" > $gfile
fi
/bin/awk 'END { printf "'"$URL"'" }' </dev/null >> $gfile

trap "echo signal encountered" 30
kill -USR1 $pid

exit 0

您也可以看看 MosaicMail (URL 為 http://www.oac.uci.edu/indiv/ehood/mhonarc.doc.html ), 這是一個 Perl 程式,它將郵件以及/或是新聞討論群文件轉送到您目前的 Mosaic 中。


World Wide Web FAQ