commit 8a596ab372aec99e49ee9422facd6ee5268edd31
parent 2573cb76cd21c7db5a94b9afd27a91dc215a0421
Author: ukai <ukai>
Date: Fri, 30 Nov 2001 16:48:12 +0000
[w3m-dev 02600]
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
5 files changed, 265 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,24 @@
2001-12-01 Fumitoshi UKAI <ukai@debian.or.jp>
+ * scripts/.cvsignore: add w3mhelp.cgi w3mhelp-*.pl
+ * scripts/Makefile (HELP_DIR): added
+ * scripts/Makefile (LIB_TARGETS): add w3mhelp.cgi
+ * scripts/Makefile (DOCDIRS): added
+ * scripts/Makefile (all): add helplibs
+ * scripts/Makefile (.in): subst HELP_DIR, DOCDIRS
+ * scripts/Makefile (helplibs): added
+ * scripts/Makefile (install): s/DISTDIR/DESTDIR/
+ * scripts/Makefile (install): install w3mhelp-*.pl
+
+ * scripts/w3mhelp.cgi.in: added
+
+ * XMakefile (INSTALL2): deleted
+ * XMakefile (install): split
+ * XMakefile (install-core): added
+ * XMakefile (install-helpfile): added
+ * XMakefile (all-scripts): HELP_DIR
+ * XMakefile (install-scripts): HELP_DIR
+
* doc/REAMDE.func: add ALARM, SUSPEND
* doc-jp/README.func: ditto
diff --git a/XMakefile b/XMakefile
@@ -30,7 +30,6 @@ CFLAGS=$(OPTS) $(MYCFLAGS) $(DEFS)
LIBS=-L. -lindep $(GCLIB) $(MATHLIB) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES)
LIBS2=-L. -lindep $(GCLIB) $(LOCAL_LIBRARIES)
INSTALL=sh install.sh
-INSTALL2=sh ../install.sh
AR=ar
all: $(TARGETS) all-scripts
@@ -83,29 +82,32 @@ gc/gc.a:
cd gc; $(MAKE) CC='$(CC)' CFLAGS='$(GCCFLAGS) $(GC_CFLAGS)' SPECIALCFLAGS='-I./\$(srcdir)/include $(GC_CFLAGS)'
-install: $(TARGETS) all-scripts
+install: install-core install-scripts
+
+install-core: $(TARGETS)
-$(MKDIR) $(DESTDIR)$(BIN_DIR)
-$(MKDIR) $(DESTDIR)$(HELP_DIR)
-$(MKDIR) $(DESTDIR)$(LIB_DIR)
$(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(BIN_DIR)/$(TARGET)
+ $(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
+ for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
+
+install-helpfile:
$(INSTALL) -m 644 w3mhelp-w3m_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-w3m_en.html
$(INSTALL) -m 644 w3mhelp-w3m_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-w3m_ja.html
$(INSTALL) -m 644 w3mhelp-lynx_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_en.html
$(INSTALL) -m 644 w3mhelp-lynx_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_ja.html
- $(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
- for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
- (cd scripts; for i in *.cgi; do $(INSTALL2) -m 755 $$i $(DESTDIR)$(LIB_DIR)/$$i; done)
all-scripts:
for dir in $(SCRIPTSUBDIRS); \
do \
- (cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)'); \
+ (cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)'); \
done
install-scripts: all-scripts
for dir in $(SCRIPTSUBDIRS); \
do \
- (cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' DESTDIR='$(DESTDIR)' INSTALL='sh $(PWD)/install.sh' install); \
+ (cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)' DESTDIR='$(DESTDIR)' INSTALL='sh $(PWD)/install.sh' install); \
done
uninstall:
diff --git a/scripts/.cvsignore b/scripts/.cvsignore
@@ -1 +1,4 @@
dirlist.cgi
+w3mhelp.cgi
+w3hmhelp-*.pl
+
diff --git a/scripts/Makefile b/scripts/Makefile
@@ -3,27 +3,69 @@ prefix = /usr/local
DESTDIR =
BIN_DIR = $(prefix)/bin
LIB_DIR = $(prefix)/lib/w3m
+HELP_DIR = $(prefix)/lib/w3m
-LIB_TARGETS = dirlist.cgi
+LIB_TARGETS = dirlist.cgi w3mhelp.cgi
INSTALL = install -c
INSTALL_SCRIPT = $(INSTALL) -m 755
PERL = /usr/local/bin/perl
+DOCDIRS = doc:en_English doc-jp:ja_Japanese
+
.SUFFIXES: .in
-all: $(LIB_TARGETS)
+all: $(LIB_TARGETS) helplibs
.in:
- sed 's%@PERL@%$(PERL)%' $< > $@
- chmod +x $@
+ @echo "generating $@..."
+ @sed -e 's%@PERL@%$(PERL)%' -e 's%@HELP_DIR@%$(HELP_DIR)%' \
+ -e 's%@DOCDIRS@%$(DOCDIRS)%' $< > $@
+ @chmod +x $@
+ @echo done
+
+helplibs:
+ @echo "generating w3mhelp-funcname.pl..."
+ @echo '%funcname = (' > w3mhelp-funcname.pl
+ @while read fname fid; do \
+ case "$$fname" in [a-zA-Z@]*) echo "'$$fname', '$$fid',";; esac; \
+ done < ../funcname.tab >> w3mhelp-funcname.pl
+ @echo ');' >> w3mhelp-funcname.pl
+ @echo '%keyfunc = (' >> w3mhelp-funcname.pl
+ @case "$(KEYBIND_SRC)" in *lynx*) keymap=keymap.lynx;; *) keymap=keymap.default;; esac; \
+ while read keyword keys func rest; do \
+ if [ "X$$keyword" = Xkeymap ]; then \
+ keys=`echo "$$keys" | sed -e 's/\\\\/\\\\&/g'`; \
+ echo "'$$keys', '$$func',"; \
+ fi; \
+ done < ../doc/$$keymap >> w3mhelp-funcname.pl
+ @echo ');' >> w3mhelp-funcname.pl
+ @echo '1;' >> w3mhelp-funcname.pl
+ @echo "done"
+
+ @echo "generating w3mhelp-funcdesc*.pl..."
+ @for dirlang in $(DOCDIRS); do \
+ dir=`expr "$$dirlang" : "\(.*\):.*"`; \
+ lang=`expr "$$dirlang" : ".*:\(.*\)_.*"`; \
+ echo '%funcdesc = (' > w3mhelp-funcdesc.$$lang.pl; \
+ while read func desc; do \
+ case "$$func" in [a-zA-Z@]*) echo "'$$func', '$$desc', ";; esac; \
+ done < ../$$dir/README.func >> w3mhelp-funcdesc.$$lang.pl; \
+ echo ');' >> w3mhelp-funcdesc.$$lang.pl; \
+ echo '1;' >> w3mhelp-funcdesc.$$lang.pl; \
+ done
+ @echo done
install: $(LIB_TARGETS)
for file in $(LIB_TARGETS); \
do \
- $(INSTALL_SCRIPT) $$file $(DISTDIR)$(LIB_DIR); \
+ $(INSTALL_SCRIPT) $$file $(DESTDIR)$(LIB_DIR); \
+ done
+ for file in w3mhelp-*.pl; \
+ do \
+ $(INSTALL) $$file $(DESTDIR)$(HELP_DIR); \
done
clean:
- rm -f $(LIB_TARGETS)
+ rm -f $(LIB_TARGETS) w3mhelp-*.pl
diff --git a/scripts/w3mhelp.cgi.in b/scripts/w3mhelp.cgi.in
@@ -0,0 +1,186 @@
+#!@PERL@
+# $Id$
+
+$helpdir="@HELP_DIR@";
+unshift(@INC, $helpdir);
+@docdirs=qw(@DOCDIRS@);
+
+require "w3mhelp-funcname.pl";
+require "w3mhelp-funcdesc.en.pl";
+$lang = 'en';
+
+%htmlesc = qw(< < > > & &);
+
+$keymap = "$ENV{'HOME'}/.w3m/keymap";
+$version = '*unknown*';
+if (defined($ENV{'QUERY_STRING'})) {
+ print "QUERY_STRING=$ENV{'QUERY_STRING'}\n";
+ if ($ENV{'QUERY_STRING'} =~ /(^|&)version=([^&]*)/) {
+ $version = $2;
+ $version =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge;
+ $version =~ s/w3m\///;
+ }
+ if ($ENV{'QUERY_STRING'} =~ /(^|&)lang=([^&]*)/) {
+ local $tlang=$2;
+ $tlang =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge;
+ $tlang =~ tr/A-Z/a-z/;
+ print "tlang=$tlang\n";
+ eval qq{require "w3mhelp-funcdesc.$tlang.pl"};
+ if (defined(%funcdesc)) {
+ $lang = $tlang;
+ }
+ }
+}
+
+if (-f $keymap) {
+ open(KEYMAP, $keymap) or die "cannot open keymap: $keymap, $!";
+ &load_keymap(*KEYMAP, $func);
+ close(KEYMAP);
+}
+
+local (%funckeydesc, $key, $fname, $desc);
+
+while (($fname, $desc) = each %funcdesc) {
+ $funckeydesc{$funcname{$fname}} = "$desc\n";
+}
+while (($key, $fname) = each %keyfunc) {
+ $funckeydesc{$funcname{$fname}} .= "$key,";
+}
+
+print <<HEADING;
+Content-Type: text/html
+
+<HTML>
+<HEAD>
+<TITLE>w3m help page</TITLE>
+</HEAD>
+<BODY>
+<CENTER>
+*******
+<A HREF="http://w3m.sourceforge.net/">w3m</A>
+ (WWW-wo-Miru) Version $version by
+<A HREF="mailto:aito\@fw.ipsj.or.jp">A.ITO</A> ********<BR>
+ ***** Key assign table *****
+</CENTER>
+
+HEADING
+
+$q_version = $version;
+$q_version =~ s/[^A-Za-z0-9_\$\.\-]/sprintf('%%%02X', ord($&))/ge;
+$script = "<A HREF=\"$ENV{'SCRIPT_NAME'}?version=$q_version&lang=";
+
+# doc:en_English doc-jp:ja_Japanese
+for $otherlang (@docdirs) {
+ local(@d) = split(/[:_]/, $otherlang);
+
+ if ($d[1] ne $lang) {
+ $d[1] =~ s/[^A-Za-z0-9_\$\.\-]/sprintf('%%%02X', ord($&))/ge;
+ print $script, $d[1], "\">$d[2] version</A><BR>\n";
+ }
+}
+
+&show_keymap("Page/Cursor motion",
+ qw(pgFore pgBack movR movL movD movU lup1 ldown1
+ goLineF goLineL movRW movLW shiftl shiftr
+ col1R col1L goLine ctrCsrH ctrCsrV
+ topA lastA nextA prevA
+ nextL nextLU nextR nextRD nextD nextU));
+
+&show_keymap("Hyperlink operation",
+ qw(followA svA peekURL peekIMG followI svI
+ chkURL chkNMID curURL pginfo curlno ldHist
+ rFrame extbrz linkbrz));
+
+&show_keymap("File/Stream operation",
+ qw(goURL ldfile readsh pipesh));
+
+&show_keymap("Buffer operation",
+ qw(backBf vwSrc selMn editBf rdrwSc reload
+ svBuf svSrc editScr));
+
+print <<PAGE;
+<H2>Buffer selection mode</H2>
+<table cellpadding=0>
+<TR><TD WIDTH=140>k, C-p<TD>Select previous buffer
+<TR><TD>j, C-n<TD>Select next buffer
+<TR><TD>D<TD>Delete current buffer
+<TR><TD>RET<TD>Go to the selected buffer
+</table>
+PAGE
+
+&show_keymap("Bookmark operation",
+ qw(ldBmark adBmark));
+
+&show_keymap("Search",
+ qw(srchfor srchbak srchnxt srchprv));
+
+&show_keymap("Dictionary look-up",
+ qw(dictword dictwordat));
+
+&show_keymap("Mark operation",
+ qw(_mark prevMk nextMk reMark));
+
+&show_keymap("Miscellany",
+ qw(setAlarm execsh ldhelp ldOpt cooLst susp qquitfm quitfm));
+
+print <<PAGE;
+<H2>Line-edit mode</H2>
+<table cellpadding=0>
+<TR><TD WIDTH=140>C-f<TD>Move cursor forward
+<TR><TD>C-b<TD>Move cursor backward
+<TR><TD>C-h<TD>Delete previous character
+<TR><TD>C-d<TD>Delete current character
+<TR><TD>C-k<TD>Kill everything after cursor
+<TR><TD>C-u<TD>Kill everything before cursor
+<TR><TD>C-a<TD>Move to the top of line
+<TR><TD>C-e<TD>Move to the bottom of line
+<TR><TD>C-p<TD>Fetch the previous string from the history list
+<TR><TD>C-n<TD>Fetch the next string from the history list
+<TR><TD>TAB,SPC<TD>Complete filename
+<TR><TD>RETURN<TD>Accept
+</table>
+<HR>
+</BODY>
+</HTML>
+PAGE
+
+exit 0;
+
+sub load_keymap {
+ local(*FH) = shift;
+ my ($func) = @_;
+
+ while (<FH>) {
+ next if /^#/;
+ next if /^\s*$/;
+ ($keymap, $key, $fname) = split;
+ next unless $keymap =~ /keymap/;
+ $fname =~ tr/a-z/A-Z/;
+ next unless (defined($funcdesc{$fname}));
+ $key =~ s/^\\//;
+ $keyfunc{$key} = $fname;
+ }
+}
+
+sub show_keymap {
+ my ($head, @list) = @_;
+ my ($fid);
+ my ($attr) = " WIDTH=140";
+
+ print <<PAGE;
+<H2>$head</H2>
+<table cellpadding=0>
+PAGE
+ foreach $fid (@list) {
+ local ($desc, $keys) = split("\n", $funckeydesc{$fid}, 2);
+ $keys =~ s/,$//;
+ $keys = '<NOT ASSIGNED>' if ($keys eq '');
+ $keys =~ s/[<>&]/$htmlesc{$&}/ge;
+ $desc =~ s/[<>&]/$htmlesc{$&}/ge;
+ print <<PAGE;
+<TR><TD$attr>$keys</TD><TD>$desc</TD></TR>
+PAGE
+ $attr = "";
+ }
+ print "</table>\n";
+}