From 3888822eef9cb6c5dcba2657441ec47a09fc33d0 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 18 Dec 2002 16:48:02 +0000 Subject: [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 --- scripts/w3mman/w3mman2html.cgi.in | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'scripts/w3mman/w3mman2html.cgi.in') 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() { if (! defined($header)) { /^\s*$/ && next; @@ -147,11 +149,30 @@ EOF s@(http|ftp)://[\w.\-/~]+[\w/]@$&@g; s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1$2$3@g; - s@(\W)(\~?/[\w.][/\w.\-]*)@$1 . &file_ref($2)@ge; - s@(include(<\/?[bu]\>|\s)*\<)([/\w.\-]+)@$1 . &include_ref($3)@ge; + s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge; + s@(include(<\/?[bu]\>|\s)*\<)([\w.\-/]+)@$1 . &include_ref($3)@ge; + if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\)*(\([\dm]\w*\))@) { + $cmd .= "$2$4"; + $prev =~ s@(\w[\w.\-]*-)((\)*\s*)$@$1$2@; + print $prev; + $prev = ''; + s@^(\s*(\<[bu]\>)*)(\w[\w.\-]*)@@; + print "$1$3"; + } elsif ($prev) { + print $prev; + $prev = ''; + } s@(\w[\w.\-]*)((\)*)(\([\dm]\w*\))@$1$2$4@g; + if (m@(\w[\w.\-]*)-(\)*\s*$@) { + $cmd = $1; + $prev = $_; + next; + } print; } +if ($prev) { + print $prev; +} close(F); if (! $ok) { if ($query{'quit'}) { -- cgit v1.2.3