aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/w3mman
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-12-18 16:48:02 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-12-18 16:48:02 +0000
commit3888822eef9cb6c5dcba2657441ec47a09fc33d0 (patch)
treeabbcbb0a7ca94e8ec13be17bbcf3d62693fe5bf4 /scripts/w3mman
parent[w3m-dev 03582] add config options graphic_char and use_proxy (diff)
downloadw3m-3888822eef9cb6c5dcba2657441ec47a09fc33d0.tar.gz
w3m-3888822eef9cb6c5dcba2657441ec47a09fc33d0.zip
[w3m-dev 03583] w3mman
* scripts/w3mman/README: W3MMAN_W3M, W3MMAN_MAN * scripts/w3mman/w3mman.1.in: add ENVIRONMENT * scripts/w3mman/w3mman.in: $ENV{'W3MMAN_W3M'}, $ENV{'W3MMAN_MAN'} * scripts/w3mman/w3mman2html.cgi.in: $ENV{'W3MMAN_MAN'} hyphenation From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--scripts/w3mman/README7
-rw-r--r--scripts/w3mman/w3mman.1.in7
-rw-r--r--scripts/w3mman/w3mman.in4
-rw-r--r--scripts/w3mman/w3mman2html.cgi.in27
4 files changed, 40 insertions, 5 deletions
diff --git a/scripts/w3mman/README b/scripts/w3mman/README
index 0fc817e..3bcbb3b 100644
--- a/scripts/w3mman/README
+++ b/scripts/w3mman/README
@@ -11,6 +11,13 @@ w3mman
w3mman [<section>] <command>
w3mman -k <keyword>
+環境変数
+
+ W3MMAN_W3M
+ 使用する w3m コマンドを指定します(デフォルトは w3m)
+ W3MMAN_MAN
+ 使用する man コマンドを指定します(デフォルトは man)
+
インストール
make install
diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in
index 2221200..3bc5998 100644
--- a/scripts/w3mman/w3mman.1.in
+++ b/scripts/w3mman/w3mman.1.in
@@ -34,6 +34,13 @@ as MANPATH.
.B \-k " keyword"
Specify
.I keyword.
+.SH ENVIRONMENT
+.TP
+.B W3MMAN_W3M
+If W3MMAN_W3M is set, its value is used instead of @W3M@.
+.TP
+.B W3MMAN_MAN
+If W3MMAN_MAN is set, its value is used instead of @MAN@.
.SH FILES
.TP
.I @LIB_DIR@/w3mman2html.cgi
diff --git a/scripts/w3mman/w3mman.in b/scripts/w3mman/w3mman.in
index 0c57135..6c6f65d 100644
--- a/scripts/w3mman/w3mman.in
+++ b/scripts/w3mman/w3mman.in
@@ -1,7 +1,7 @@
#!@PERL@
-@W3M = split(' ', '@W3M@');
-$ENV{'MAN'} = '@MAN@';
+@W3M = split(' ', $ENV{'W3MMAN_W3M'} || '@W3M@');
+$ENV{'W3MMAN_MAN'} ||= '@MAN@';
$SCRIPT = 'file:///$LIB/w3mman2html.cgi';
sub usage {
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
index 88eb8d0..f41d487 100644
--- a/scripts/w3mman/w3mman2html.cgi.in
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -1,6 +1,6 @@
#!@PERL@
-$MAN = $ENV{'MAN'} || '@MAN@';
+$MAN = $ENV{'W3MMAN_MAN'} || '@MAN@';
$QUERY = $ENV{'QUERY_STRING'} || $ARGV[0];
$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0;
$CGI = "file://$SCRIPT_NAME";
@@ -89,6 +89,8 @@ open(F, "$MAN $section $man 2> /dev/null |");
$ok = 0;
undef $header;
$blank = -1;
+$cmd = "";
+$prev = "";
while(<F>) {
if (! defined($header)) {
/^\s*$/ && next;
@@ -147,11 +149,30 @@ EOF
s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g;
s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g;
- s@(\W)(\~?/[\w.][/\w.\-]*)@$1 . &file_ref($2)@ge;
- s@(include(<\/?[bu]\>|\s)*\&lt;)([/\w.\-]+)@$1 . &include_ref($3)@ge;
+ s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge;
+ s@(include(<\/?[bu]\>|\s)*\&lt;)([\w.\-/]+)@$1 . &include_ref($3)@ge;
+ if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) {
+ $cmd .= "$2$4";
+ $prev =~ s@(\w[\w.\-]*-)((\</[bu]\>)*\s*)$@<a href="$CGI?$cmd">$1</a>$2@;
+ print $prev;
+ $prev = '';
+ s@^(\s*(\<[bu]\>)*)(\w[\w.\-]*)@@;
+ print "$1<a href=\"$CGI?$cmd\">$3</a>";
+ } elsif ($prev) {
+ print $prev;
+ $prev = '';
+ }
s@(\w[\w.\-]*)((\</[bu]\>)*)(\([\dm]\w*\))@<a href="$CGI?$1$4">$1</a>$2$4@g;
+ if (m@(\w[\w.\-]*)-(\</[bu]\>)*\s*$@) {
+ $cmd = $1;
+ $prev = $_;
+ next;
+ }
print;
}
+if ($prev) {
+ print $prev;
+}
close(F);
if (! $ok) {
if ($query{'quit'}) {