mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Merge branch 'elinks-0.12' into elinks-0.13
Conflicts: doc/man/man1/elinks.1.in doc/man/man5/elinks.conf.5 Resolved by regenerating the files with make update-man.
This commit is contained in:
commit
af1f475417
3
AUTHORS
3
AUTHORS
@ -433,6 +433,9 @@ Omar Khayam <omark@cyentec.com>
|
||||
<otte@duke.edu>
|
||||
Fix stdin reading on Mac OS X
|
||||
|
||||
Paul B. Mahol <onemda@gmail.com>
|
||||
Recognize Insert key on cons25 (FreeBSD console)
|
||||
|
||||
Pavol Babincak <scroolik@gmail.com>
|
||||
Improved UTF-8 support with double-width chars
|
||||
|
||||
|
2
NEWS
2
NEWS
@ -365,6 +365,7 @@ To be released as 0.11.4.
|
||||
* major bug 788: don't read STRLEN n_a, which isn't initialized by
|
||||
POPpx of Perl v5.8.8 and later
|
||||
* fix query parsing in file: URIs for local CGI (was broken in 0.11.3)
|
||||
* bug 451: fix incompatible pointer type in PERL_SYS_INIT3 call
|
||||
* bug 691: don't look up bogus IPv4 addresses based on characters of a
|
||||
hostname
|
||||
* bug 712: GnuTLS works on https://www-s.uiuc.edu/[]
|
||||
@ -372,6 +373,7 @@ To be released as 0.11.4.
|
||||
* bug 938: elinks -remote no longer needs a controlling tty
|
||||
* bug 939: fix FSP directory listing (some compiler options left it empty)
|
||||
* bug 978: Python's webbrowser.open_new_tab(URL) works since now
|
||||
* bug 1012: compile with -fno-strict-overflow or -fwrapv if available
|
||||
* minor bug 54, Debian bug 338402: don't force the terminal to 8 bits
|
||||
with no parity, and don't disable XON/XOFF flow control either
|
||||
* minor bug 951 in user SMJS: garbage-collect SMJS objects on 'File ->
|
||||
|
55
configure.in
55
configure.in
@ -1457,6 +1457,61 @@ if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
|
||||
[AC_MSG_RESULT([no])])
|
||||
EL_RESTORE_FLAGS
|
||||
done
|
||||
|
||||
# Bug 1012: Some parts of ELinks do arithmetic with signed integers
|
||||
# in such a way that an overflow is possible. GCC 4.2.1 warns
|
||||
# "warning: assuming signed overflow does not occur when assuming
|
||||
# that (X + c) > X is always true", which may be an incorrect
|
||||
# optimization (although allowed by the standard), and breaks the
|
||||
# build with -Werror.
|
||||
#
|
||||
# All of the following tests included -S -Wall -Wextra:
|
||||
#
|
||||
# GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
|
||||
# * gcc-4.0 -O0: OK, compares the values
|
||||
# * gcc-4.0 -O2: assumes no overflow, does not warn
|
||||
# * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
|
||||
# * gcc-4.0 -O0 -fwrapv: OK, compares the values
|
||||
# * gcc-4.0 -O2 -fwrapv: OK, compares the values
|
||||
# * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
|
||||
# * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
|
||||
#
|
||||
# GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
|
||||
# * gcc-4.1 -O0: assumes no overflow, does not warn
|
||||
# * gcc-4.1 -O2: assumes no overflow, does not warn
|
||||
# * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
|
||||
# * gcc-4.1 -O0 -fwrapv: OK, compares the values
|
||||
# * gcc-4.1 -O2 -fwrapv: OK, compares the values
|
||||
# * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.1 -O2 -ftrapv: compares the values
|
||||
# * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
|
||||
#
|
||||
# GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
|
||||
# * gcc-4.2 -O0: OK, compares the values
|
||||
# * gcc-4.2 -O2: assumes no overflow, warns about it
|
||||
# * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
|
||||
# * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
|
||||
# * gcc-4.2 -O0 -fwrapv: OK, compares the values
|
||||
# * gcc-4.2 -O2 -fwrapv: OK, compares the values
|
||||
# * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.2 -O2 -ftrapv: compares the values
|
||||
# * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
|
||||
# * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
|
||||
#
|
||||
# Apparently, -ftrapv does not work reliably at all.
|
||||
for overflow_flag in -fno-strict-overflow -fwrapv; do
|
||||
AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
|
||||
EL_SAVE_FLAGS
|
||||
CFLAGS="$CFLAGS $overflow_flag"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
break],
|
||||
[AC_MSG_RESULT([no])])
|
||||
EL_RESTORE_FLAGS
|
||||
done
|
||||
fi
|
||||
|
||||
EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
|
||||
|
24
doc/Makefile
24
doc/Makefile
@ -26,8 +26,6 @@ TXT_DOCS_NOINSTALL = \
|
||||
features.txt \
|
||||
keymap-actions.txt \
|
||||
keymap-defaults.txt \
|
||||
option-command.txt \
|
||||
option-config.txt
|
||||
|
||||
TXT_DOCS_ASIS = \
|
||||
python.txt
|
||||
@ -110,7 +108,7 @@ install-local:
|
||||
# Generated asciidoc files
|
||||
|
||||
# Scripts and Dependencies
|
||||
HELP2DOC = $(srcdir)tools/help2doc
|
||||
HELP2XML = $(srcdir)tools/help2xml
|
||||
CONF2DOC = $(srcdir)tools/conf2doc
|
||||
KEYS2DOC = $(srcdir)tools/keys2doc
|
||||
ELINKS = $(top_builddir)/src/elinks
|
||||
@ -123,8 +121,8 @@ LOCALES = LC_ALL=C LANGUAGE=en
|
||||
|
||||
# FIXME: Keep generated .txt files relative to the source directory and files
|
||||
# they are included in.
|
||||
quiet_cmd_help2doc = ' [$(LINK_COLOR)HELP2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||
cmd_help2doc = $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@
|
||||
quiet_cmd_help2xml = ' [$(LINK_COLOR)HELP2XML$(END_COLOR)] $(RELPATH)$@'
|
||||
cmd_help2xml = $(LOCALES) $(HELP2XML) $(ELINKS) $@
|
||||
|
||||
quiet_cmd_conf2doc = ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@'
|
||||
cmd_conf2doc = $(LOCALES) $(CONF2DOC) $(FEATURES) > $@
|
||||
@ -138,9 +136,11 @@ features.txt: $(FEATURES) $(CONF2DOC)
|
||||
keymap-%.txt: $(KBDBIND) $(KEYS2DOC)
|
||||
$(call cmd,keys2doc)
|
||||
|
||||
option-%.txt: $(ELINKS) $(HELP2DOC)
|
||||
$(call cmd,help2doc)
|
||||
option-%.frag.xml: $(ELINKS) $(HELP2XML)
|
||||
$(call cmd,help2xml)
|
||||
|
||||
option-%.frag.xhtml: $(ELINKS) $(HELP2XML)
|
||||
$(call cmd,help2xml)
|
||||
|
||||
#############################################################################
|
||||
# Build commands and macros
|
||||
@ -166,7 +166,7 @@ backend = $(if $(findstring .xml,$@),docbook,xhtml11)
|
||||
outdir = $(if $(findstring -chunked,$@),$@,.)
|
||||
|
||||
# Loosely track dependencies via asciidoc includes.
|
||||
asciidoc_dep = sed -n 's/[{]builddir}//g;s@include::\(.*\)\[.*@$@: $< \1@p' < $< > .deps/$(@F).asciidoc
|
||||
asciidoc_dep = sed -n 's/[{]builddir}//g;s@include1\{0,1\}::\(.*\)\[.*@$@: $< \1@p' < $< > .deps/$(@F).asciidoc
|
||||
|
||||
-include .deps/*.asciidoc
|
||||
|
||||
@ -182,6 +182,14 @@ asciidoc_dep = sed -n 's/[{]builddir}//g;s@include::\(.*\)\[.*@$@: $< \1@p' < $<
|
||||
$(call cmd,asciidoc,docbook)
|
||||
@-$(call asciidoc_dep)
|
||||
|
||||
# asciidoc_dep above also generates these dependencies, but it runs
|
||||
# only after asciidoc has succeeded, which won't happen if the files
|
||||
# are missing.
|
||||
elinks.1.xml: option-command.frag.xml
|
||||
elinks.conf.5.xml: option-config.frag.xml
|
||||
elinks.1.html: option-command.frag.xhtml
|
||||
elinks.conf.5.html: option-config.frag.xhtml
|
||||
|
||||
%.1: %.1.xml
|
||||
$(call cmd,xmlto,man)
|
||||
|
||||
|
@ -35,7 +35,14 @@ Most options can be set in the user interface or config file, so usually you
|
||||
do not need to care about them. Note that this list is roughly equivalent to
|
||||
the output of running ELinks with the option `--long-help`.
|
||||
|
||||
include::{builddir}option-command.txt[]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
ifdef::backend-docbook[]
|
||||
include1::{builddir}option-command.frag.xml[]
|
||||
endif::backend-docbook[]
|
||||
ifdef::backend-xhtml11[]
|
||||
include1::{builddir}option-command.frag.xhtml[]
|
||||
endif::backend-xhtml11[]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
---------------------
|
||||
|
@ -57,7 +57,15 @@ Some sample settings:
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
include::{builddir}option-config.txt[]
|
||||
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
ifdef::backend-docbook[]
|
||||
include1::{builddir}option-config.frag.xml[]
|
||||
endif::backend-docbook[]
|
||||
ifdef::backend-xhtml11[]
|
||||
include1::{builddir}option-config.frag.xhtml[]
|
||||
endif::backend-xhtml11[]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
6
doc/man/.gitignore
vendored
6
doc/man/.gitignore
vendored
@ -1,3 +1,9 @@
|
||||
index.bt
|
||||
manpage.links
|
||||
manpage.refs
|
||||
|
||||
# elinks.conf.5 and elinkskeys.5 are first built in $(top_builddir)/doc/,
|
||||
# where they should be ignored, but then "make update-man" can copy them
|
||||
# to $(top_srcdir)/doc/man/man5/, where they should not be ignored.
|
||||
# Override the "*.5" pattern listed in $(top_srcdir)/doc/.gitignore.
|
||||
!*.5
|
||||
|
@ -1,11 +1,11 @@
|
||||
.\" Title: elinks
|
||||
.\" Author:
|
||||
.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
|
||||
.\" Date: 03/08/2008
|
||||
.\" Date: 06/08/2008
|
||||
.\" Manual: The Elinks text-browser
|
||||
.\" Source: ELinks 0.13.GIT
|
||||
.\"
|
||||
.TH "ELINKS" "1" "03/08/2008" "ELinks 0.13.GIT" "The Elinks text\-browser"
|
||||
.TH "ELINKS" "1" "06/08/2008" "ELinks 0.13.GIT" "The Elinks text\-browser"
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
@ -28,221 +28,210 @@ The homepage of \fIELinks\fR can be found at <http://elinks.cz/>, where the ELin
|
||||
Most options can be set in the user interface or config file, so usually you do not need to care about them. Note that this list is roughly equivalent to the output of running ELinks with the option \-\-long\-help.
|
||||
.sp
|
||||
.PP
|
||||
\-anonymous [0|1] (default: 0)
|
||||
\fB\-anonymous\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Restricts
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
so it can run on an anonymous account. Local file browsing, downloads, and modification of options will be disabled. Execution of viewers is allowed, but entries in the association table can't be added or modified.
|
||||
.RE
|
||||
.PP
|
||||
\-auto\-submit [0|1] (default: 0)
|
||||
\fB\-auto\-submit\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Automatically submit the first form in the given URLs.
|
||||
.RE
|
||||
.PP
|
||||
\-base\-session <num> (default: 0)
|
||||
\fB\-base\-session\fR \fI<num>\fR (default: 0)
|
||||
.RS 4
|
||||
Used internally when opening
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
instances in new windows. The ID maps to information that will be used when creating the new instance. You don't want to use it.
|
||||
.RE
|
||||
.PP
|
||||
\-config\-dir <str> (default: "")
|
||||
\fB\-config\-dir\fR \fI<str>\fR (default: "")
|
||||
.RS 4
|
||||
Path of the directory
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
will read and write its config and runtime state files to instead of
|
||||
~/.elinks. If the path does not begin with a '/' it is assumed to be relative to your
|
||||
\fIHOME\fR
|
||||
\fI~/.elinks\fR. If the path does not begin with a '/' it is assumed to be relative to your
|
||||
\fBHOME\fR
|
||||
directory.
|
||||
.RE
|
||||
.PP
|
||||
\-config\-dump
|
||||
\fB\-config\-dump\fR
|
||||
.RS 4
|
||||
Print a configuration file with options set to the built\-in defaults to stdout.
|
||||
.RE
|
||||
.PP
|
||||
\-config\-file <str> (default: "elinks.conf")
|
||||
\fB\-config\-file\fR \fI<str>\fR (default: "elinks.conf")
|
||||
.RS 4
|
||||
Name of the configuration file that all configuration options will be read from and written to. It should be relative to config\-dir.
|
||||
Name of the configuration file that all configuration options will be read from and written to. It should be relative to
|
||||
config\-dir.
|
||||
.RE
|
||||
.PP
|
||||
\-config\-help
|
||||
\fB\-config\-help\fR
|
||||
.RS 4
|
||||
Print help for configuration options and exit.
|
||||
.RE
|
||||
.PP
|
||||
\-default\-mime\-type (alias for mime.default_type)
|
||||
\fB\-default\-mime\-type\fR (alias for mime.default_type)
|
||||
.RS 4
|
||||
The default MIME type used for documents of unknown type.
|
||||
.RE
|
||||
.PP
|
||||
\-default\-keys [0|1] (default: 0)
|
||||
\fB\-default\-keys\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
When set, all keybindings from configuration files will be ignored. It forces use of default keybindings and will reset user\-defined ones on save.
|
||||
.RE
|
||||
.PP
|
||||
\-dump [0|1] (default: 0)
|
||||
\fB\-dump\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Print formatted plain\-text versions of given URLs to stdout.
|
||||
.RE
|
||||
.PP
|
||||
\-dump\-charset (alias for document.dump.codepage)
|
||||
\fB\-dump\-charset\fR (alias for document.dump.codepage)
|
||||
.RS 4
|
||||
Codepage used when formatting dump output.
|
||||
.RE
|
||||
.PP
|
||||
\-dump\-color\-mode (alias for document.dump.color_mode)
|
||||
\fB\-dump\-color\-mode\fR (alias for document.dump.color_mode)
|
||||
.RS 4
|
||||
Color mode used with
|
||||
\-dump.
|
||||
.RE
|
||||
.PP
|
||||
\-dump\-width (alias for document.dump.width)
|
||||
\fB\-dump\-width\fR (alias for document.dump.width)
|
||||
.RS 4
|
||||
Width of the dump output.
|
||||
.RE
|
||||
.PP
|
||||
\-eval
|
||||
\fB\-eval\fR
|
||||
.RS 4
|
||||
Specify configuration file directives on the command\-line which will be evaluated after all configuration files has been read. Example usage:
|
||||
.sp
|
||||
.RS 4
|
||||
.nf
|
||||
\-eval 'set protocol.file.allow_special_files = 1'
|
||||
.fi
|
||||
.RE
|
||||
\fB\-eval 'set protocol.file.allow_special_files = 1'\fR
|
||||
.RE
|
||||
.PP
|
||||
\-force\-html
|
||||
\fB\-force\-html\fR
|
||||
.RS 4
|
||||
Makes
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
assume documents of unknown types are HTML. Useful when using
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
as an external viewer from MUAs. This is equivalent to
|
||||
\-default\-mime\-type
|
||||
text/html.
|
||||
\fB\-default\-mime\-type\fR\fB text/html\fR.
|
||||
.RE
|
||||
.PP
|
||||
\-?, \-h, \-help
|
||||
\fB\-?\fR, \fB\-h\fR, \fB\-help\fR
|
||||
.RS 4
|
||||
Print usage help and exit.
|
||||
.RE
|
||||
.PP
|
||||
\-localhost [0|1] (default: 0)
|
||||
\fB\-localhost\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Restricts
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
to work offline and only connect to servers with local addresses (ie. 127.0.0.1). No connections to remote servers will be permitted.
|
||||
.RE
|
||||
.PP
|
||||
\-long\-help
|
||||
\fB\-long\-help\fR
|
||||
.RS 4
|
||||
Print detailed usage help and exit.
|
||||
.RE
|
||||
.PP
|
||||
\-lookup
|
||||
\fB\-lookup\fR
|
||||
.RS 4
|
||||
Look up specified host and print all DNS resolved IP addresses.
|
||||
.RE
|
||||
.PP
|
||||
\-no\-connect [0|1] (default: 0)
|
||||
\fB\-no\-connect\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Run
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
as a separate instance instead of connecting to an existing instance. Note that normally no runtime state files (bookmarks, history, etc.) are written to the disk when this option is used. See also
|
||||
\-touch\-files.
|
||||
.RE
|
||||
.PP
|
||||
\-no\-home [0|1] (default: 0)
|
||||
\fB\-no\-home\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Disables creation and use of files in the user specific home configuration directory (~/.elinks). It forces default configuration values to be used and disables saving of runtime state files.
|
||||
Disables creation and use of files in the user specific home configuration directory (\fI~/.elinks\fR). It forces default configuration values to be used and disables saving of runtime state files.
|
||||
.RE
|
||||
.PP
|
||||
\-no\-numbering (alias for document.dump.numbering)
|
||||
\fB\-no\-numbering\fR (alias for document.dump.numbering)
|
||||
.RS 4
|
||||
Prevents printing of link number in dump output. Note that this really affects only
|
||||
\-dump, nothing else.
|
||||
.RE
|
||||
.PP
|
||||
\-no\-references (alias for document.dump.references)
|
||||
\fB\-no\-references\fR (alias for document.dump.references)
|
||||
.RS 4
|
||||
Prevents printing of references (URIs) of document links in dump output. Note that this really affects only
|
||||
\-dump, nothing else.
|
||||
.RE
|
||||
.PP
|
||||
\-remote
|
||||
\fB\-remote\fR
|
||||
.RS 4
|
||||
Control a remote
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
instance by passing commands to it. The option takes an additional argument containing the method which should be invoked and any parameters that should be passed to it. For ease of use, the additional method argument can be omitted in which case any URL arguments will be opened in new tabs in the remote instance. Following is a list of the supported methods:
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
ping(): look for a remote instance
|
||||
\h'-04'\(bu\h'+03'\fBping()\fR: look for a remote instance
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
openURL(): prompt URL in current tab
|
||||
\h'-04'\(bu\h'+03'\fBopenURL()\fR: prompt URL in current tab
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
openURL(URL): open URL in current tab
|
||||
\h'-04'\(bu\h'+03'\fBopenURL(\fR\fB\fIURL\fR\fR\fB)\fR: open URL in current tab
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
openURL(URL, new\-tab): open URL in new tab
|
||||
\h'-04'\(bu\h'+03'\fBopenURL(\fR\fB\fIURL\fR\fR\fB, \fR\fBnew\-tab\fR\fB)\fR: open URL in new tab
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
openURL(URL, new\-window): open URL in new window
|
||||
\h'-04'\(bu\h'+03'\fBopenURL(\fR\fB\fIURL\fR\fR\fB, \fR\fBnew\-window\fR\fB)\fR: open URL in new window
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
addBookmark(URL): bookmark URL
|
||||
\h'-04'\(bu\h'+03'\fBaddBookmark(\fR\fB\fIURL\fR\fR\fB)\fR: bookmark URL
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
infoBox(text): show text in a message box
|
||||
\h'-04'\(bu\h'+03'\fBinfoBox(\fR\fB\fItext\fR\fR\fB)\fR: show text in a message box
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'
|
||||
xfeDoCommand(openBrowser): open new window
|
||||
\h'-04'\(bu\h'+03'\fBxfeDoCommand(\fR\fBopenBrowser\fR\fB)\fR: open new window
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
\-session\-ring <num> (default: 0)
|
||||
\fB\-session\-ring\fR \fI<num>\fR (default: 0)
|
||||
.RS 4
|
||||
ID of session ring this
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
session should connect to.
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
works in so\-called session rings, whereby all instances of
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
are interconnected and share state (cache, bookmarks, cookies, and so on). By default, all
|
||||
\fIELinks\fR
|
||||
instances connect to session ring 0. You can change that behaviour with this switch and form as many session rings as you want. Obviously, if the session\-ring with this number doesn't exist yet, it's created and this 'ELinks' instance will become the master instance (that usually doesn't matter for you as a user much). Note that you usually don't want to use this unless you're a developer and you want to do some testing \- if you want the
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
instances connect to session ring 0. You can change that behaviour with this switch and form as many session rings as you want. Obviously, if the session\-ring with this number doesn't exist yet, it's created and this
|
||||
ELinks
|
||||
instance will become the master instance (that usually doesn't matter for you as a user much). Note that you usually don't want to use this unless you're a developer and you want to do some testing \- if you want the
|
||||
ELinks
|
||||
instances each running standalone, rather use the
|
||||
\-no\-connect
|
||||
command\-line option. Also note that normally no runtime state files are written to the disk when this option is used. See also
|
||||
\-touch\-files.
|
||||
.RE
|
||||
.PP
|
||||
\-source [0|1] (default: 0)
|
||||
\fB\-source\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
Print given URLs in source form to stdout.
|
||||
.RE
|
||||
.PP
|
||||
\-touch\-files [0|1] (default: 0)
|
||||
\fB\-touch\-files\fR \fI[0|1]\fR (default: 0)
|
||||
.RS 4
|
||||
When enabled, runtime state files (bookmarks, history, etc.) are written to disk, even when
|
||||
\-no\-connect
|
||||
@ -251,27 +240,27 @@ or
|
||||
is used. The option has no effect if not used in conjunction with any of these options.
|
||||
.RE
|
||||
.PP
|
||||
\-verbose <num> (default: 1)
|
||||
\fB\-verbose\fR \fI<num>\fR (default: 1)
|
||||
.RS 4
|
||||
The verbose level controls what messages are shown at start up and while running:
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'0: means only show serious errors
|
||||
\h'-04'\(bu\h'+03'0 means only show serious errors
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'1: means show serious errors and warnings
|
||||
\h'-04'\(bu\h'+03'1 means show serious errors and warnings
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+03'2: means show all messages
|
||||
\h'-04'\(bu\h'+03'2 means show all messages
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
\-version
|
||||
\fB\-version\fR
|
||||
.RS 4
|
||||
Print
|
||||
\fIELinks\fR
|
||||
ELinks
|
||||
version information and exit.
|
||||
.RE
|
||||
Generated using output from ELinks version 0.13.GIT.
|
||||
|
File diff suppressed because it is too large
Load Diff
603
doc/tools/help2xml
Executable file
603
doc/tools/help2xml
Executable file
@ -0,0 +1,603 @@
|
||||
#! /usr/bin/perl
|
||||
# The copyright notice and license are in the POD at the bottom.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long qw(GetOptions :config bundling gnu_compat);
|
||||
use autouse 'Pod::Usage' => qw(pod2usage);
|
||||
|
||||
sub show_version
|
||||
{
|
||||
# This program has no version number, because it is only useful
|
||||
# as part of the ELinks source tree.
|
||||
print "help2xml (ELinks)\n";
|
||||
pod2usage({-verbose => 99, -sections => "COPYRIGHT AND LICENSE",
|
||||
-exitval => 0});
|
||||
}
|
||||
|
||||
# This script internally stores XML as nested arrays. Example:
|
||||
#
|
||||
# ['element', ['@id', "foo"], ['@dir', "ltr"], "text", ['subelement'], "more"]
|
||||
# <element id="foo" dir="ltr">text<subelement/>more</element>
|
||||
#
|
||||
# A node is one of:
|
||||
# - A string. This is just text and will be properly escaped when output.
|
||||
# - A reference to an array where the first array element is a string that
|
||||
# does not begin with '@'. This array represents an XML element. The
|
||||
# other array elements are the attributes and content of the XML element.
|
||||
# The current implementation does not require attributes to be listed
|
||||
# before content.
|
||||
# - A reference to an array where the first array element is a string that
|
||||
# begins with '@'. This array represents an attribute of the parent XML
|
||||
# element. The second array element is the value of the attribute; it
|
||||
# must be a string. There should be no other array elements.
|
||||
#
|
||||
# So there is no way to represent XML declarations, processing instructions,
|
||||
# comments, doctypes, or general entity references.
|
||||
#
|
||||
# The names of attributes in these nodes should be written in 'single quotes'
|
||||
# because "@foo" would make Perl interpolate the value of the @foo array.
|
||||
# The names of elements are also written in single quotes, by convention.
|
||||
|
||||
# xml_output($outfh, $node): Write an XML node to a filehandle.
|
||||
#
|
||||
# $outfh: A reference to the output filehandle.
|
||||
#
|
||||
# $node: An XML node represented as described above.
|
||||
#
|
||||
# return: Unspecified.
|
||||
sub xml_output
|
||||
{
|
||||
no locale;
|
||||
my ($outfh, $node) = @_;
|
||||
if (ref($node) eq "ARRAY") {
|
||||
my $gi = $node->[0];
|
||||
print $outfh "<$gi";
|
||||
my @content;
|
||||
foreach my $child (@{$node}[1..$#$node]) {
|
||||
if (ref($child) eq "ARRAY" and $child->[0] =~ /^@(.*)/) {
|
||||
my $attrname = $1;
|
||||
my $attrval = $child->[1];
|
||||
$attrval =~ s/([&"]|[^\0-~])/"&#".ord($1).";"/ge;
|
||||
print $outfh " $attrname=\"$attrval\"";
|
||||
} else {
|
||||
push @content, $child;
|
||||
}
|
||||
}
|
||||
if (@content) {
|
||||
print $outfh ">";
|
||||
foreach my $child (@content) {
|
||||
xml_output($outfh, $child);
|
||||
}
|
||||
print $outfh "</$gi>";
|
||||
} else {
|
||||
print $outfh "/>";
|
||||
}
|
||||
} else {
|
||||
$node =~ s/([&<>]|[^\0-~])/"&#".ord($1).";"/ge;
|
||||
print $outfh $node;
|
||||
}
|
||||
}
|
||||
|
||||
# xml_node_is_element($node, $gi): Check whether $node is an element
|
||||
# that has the general identifier $gi.
|
||||
sub xml_node_is_element
|
||||
{
|
||||
my ($node, $gi) = @_;
|
||||
return ref($node) eq "ARRAY" && $node->[0] eq $gi;
|
||||
}
|
||||
|
||||
# xml_element_attrs($node): Return the attributes of an XML element as
|
||||
# a list. In scalar context, return the number of attributes instead.
|
||||
sub xml_element_attrs
|
||||
{
|
||||
no locale;
|
||||
my ($node) = @_;
|
||||
# $node->[0] is the general identifier of the element, a
|
||||
# string, thus it won't match in the grep.
|
||||
return grep { ref($_) eq "ARRAY" && $_->[0] =~ /^@/ } @$node;
|
||||
}
|
||||
|
||||
# xml_element_content($node): Return the content of an XML element as
|
||||
# a list. Not recommended for use in scalar context.
|
||||
sub xml_element_content
|
||||
{
|
||||
no locale;
|
||||
my ($node) = @_;
|
||||
return grep { ref($_) ne "ARRAY" || $_->[0] !~ /^@/ } @$node[1..$#$node];
|
||||
}
|
||||
|
||||
# apply_rules($node, $rules): Apply a list of transformations to an
|
||||
# XML node.
|
||||
#
|
||||
# $node: An XML node represented as described above.
|
||||
#
|
||||
# $rules: A reference to an array of rules. The function applies the
|
||||
# rules in order: the output of a rule can be further transformed with
|
||||
# later rules but not with the same rule or earlier rules. Each rule
|
||||
# in the array is a reference to a hash that has at least these keys:
|
||||
#
|
||||
# - FIND: A regular expression. The function recursively searches for
|
||||
# matches in the content of $node, but not in names of elements,
|
||||
# names of attributes, or contents of attributes.
|
||||
# - REPLACE: A reference to a subroutine that returns a replacement for
|
||||
# the match, as a list of nodes. This subroutine is called with
|
||||
# no arguments, but it can use the $1 etc. variables that are set
|
||||
# according to the regular expression.
|
||||
#
|
||||
# return: A list of nodes.
|
||||
sub apply_rules
|
||||
{
|
||||
my ($node, $rules) = @_;
|
||||
my @output;
|
||||
if (ref($node) eq "ARRAY") {
|
||||
if ($node->[0] =~ /^@/) {
|
||||
return $node;
|
||||
} else {
|
||||
return [$node->[0],
|
||||
map({ apply_rules($_, $rules) }
|
||||
@{$node}[1..$#$node])];
|
||||
}
|
||||
} else {
|
||||
my @rules = @$rules;
|
||||
while (@rules) {
|
||||
my $rule = shift @rules;
|
||||
if ($node =~ $rule->{FIND}) {
|
||||
# Using $` or $' anywhere in the program slows down all
|
||||
# regexp matches. So get the values via substr instead.
|
||||
my $pre = substr($node, 0, $-[0]);
|
||||
my $post = substr($node, $+[0]);
|
||||
my @replacement = $rule->{REPLACE}->(); # uses $1 etc.
|
||||
return grep({ $_ ne "" }
|
||||
map({ apply_rules($_, [@rules]) }
|
||||
$pre, @replacement),
|
||||
apply_rules($post, [$rule, @rules]));
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
# html_splice_p(@nodes): If the first node in @nodes is a paragraph,
|
||||
# replace it with its content. The idea is to avoid extraneous
|
||||
# vertical space in 'dd' and 'li' elements.
|
||||
#
|
||||
# return: The new list of nodes.
|
||||
sub html_splice_p
|
||||
{
|
||||
my @nodes = @_;
|
||||
if (@nodes >= 1
|
||||
&& xml_node_is_element($nodes[0], 'p')
|
||||
&& !xml_element_attrs($nodes[0])) {
|
||||
splice(@nodes, 0, 1, xml_element_content($nodes[0]));
|
||||
}
|
||||
return @nodes;
|
||||
}
|
||||
|
||||
my %TemplatesDocBook = (
|
||||
# named DocBook elements
|
||||
APPLICATION => sub { ['application', @_] },
|
||||
COMMAND => sub { ['command', @_] },
|
||||
ENVAR => sub { ['envar', @_] },
|
||||
FILENAME => sub { ['filename', @_] },
|
||||
GUIBUTTON => sub { ['guibutton', @_] },
|
||||
GUILABEL => sub { ['guilabel', @_] },
|
||||
LINK => sub { my $linkend = shift; ['link', ['@linkend', $linkend], @_] },
|
||||
LITERAL => sub { ['literal', @_] },
|
||||
PARAMETER => sub { ['parameter', @_] },
|
||||
SIMPARA => sub { ['simpara', @_] },
|
||||
ULINK => sub { my $url = shift; ['ulink', ['@url', $url], @_] },
|
||||
USERINPUT => sub { ['userinput', @_] },
|
||||
VARIABLELIST => sub { ['variablelist', @_] },
|
||||
|
||||
# not named after DocBook elements, but pretty simple anyway
|
||||
CMDOPTTYPE => sub { ['replaceable', @_] },
|
||||
MANLINK => sub { my ($title, $volnum) = @_;
|
||||
['citerefentry', ['refentrytitle', $title], ['manvolnum', $volnum]] },
|
||||
SGMLATTR => sub { ['sgmltag', ['@class', "attribute"], @_] },
|
||||
SGMLELEMENT => sub { ['sgmltag', ['@class', "element"], @_] },
|
||||
STRONG => sub { ['emphasis', ['@role', "strong"], @_] },
|
||||
|
||||
# not so simple
|
||||
CFGOPTENTRY => sub { my ($name, $type, $default, @children) = @_;
|
||||
['varlistentry', ['@id', $name],
|
||||
['term', ['literal', $name], " ", ['type', $type], " $default"],
|
||||
['listitem', @children]] },
|
||||
CMDOPTINFO => sub { my ($info) = @_; " $info" },
|
||||
CMDOPTNAME => sub { my $id = shift; ['option', ['@id', $id], @_] },
|
||||
CFGOPTTREE => sub { my ($name, $info, @children) = @_;
|
||||
['refsect2', ['@id', $name],
|
||||
['title', ['literal', $name], " ($info)"],
|
||||
"\n", @children] },
|
||||
GUIMENUCHOICE => sub { my $item = pop; ['menuchoice', map(['guimenu', $_], @_), ['guimenuitem', $item]] },
|
||||
ITEMIZELIST => sub { ['itemizedlist', ['@spacing', "compact"],
|
||||
map { ['listitem', $_], "\n" } @_] },
|
||||
USEREXAMPLE => sub { ['informalexample', ['simpara', ['userinput', @_]]], "\n" },
|
||||
VARLISTENTRY => sub { my ($termchildren, @itemchildren) = @_;
|
||||
['varlistentry', ['term', @$termchildren],
|
||||
['listitem', @itemchildren]] },
|
||||
);
|
||||
my %TemplatesHTML = (
|
||||
# named DocBook elements
|
||||
APPLICATION => sub { ['em', @_] },
|
||||
COMMAND => sub { ['kbd', @_] },
|
||||
ENVAR => sub { ['tt', @_] },
|
||||
FILENAME => sub { ['tt', @_] },
|
||||
GUIBUTTON => sub { "[ ", @_, " ]" },
|
||||
GUILABEL => sub { @_ },
|
||||
LINK => sub { my $linkend = shift; ['a', ['@href', "#$linkend"], @_] },
|
||||
LITERAL => sub { @_ },
|
||||
PARAMETER => sub { ['var', @_] },
|
||||
SIMPARA => sub { ['p', @_] },
|
||||
ULINK => sub { my $url = shift; ['a', ['@href', $url], @_] },
|
||||
USERINPUT => sub { ['kbd', @_] },
|
||||
VARIABLELIST => sub { ['dl', @_] },
|
||||
|
||||
# not named after DocBook elements, but pretty simple anyway
|
||||
CMDOPTTYPE => sub { @_ },
|
||||
MANLINK => sub { my ($title, $volnum) = @_;
|
||||
['b', "$title($volnum)"] },
|
||||
SGMLATTR => sub { ['code', @_] },
|
||||
SGMLELEMENT => sub { ['code', @_] },
|
||||
STRONG => sub { ['strong', @_] },
|
||||
|
||||
# not so simple
|
||||
CFGOPTENTRY => sub { my ($name, $type, $default, @children) = @_;
|
||||
['dt', ['@id', $name], "$name $type $default"],
|
||||
['dd', html_splice_p(@children)] },
|
||||
CMDOPTINFO => sub { my ($info) = @_;
|
||||
if ($info =~ /^(\(alias for )([\w.]+)(\))$/) {
|
||||
return " $1", ['a', ['@href', "elinks.conf.5.html#$2"], $2], $3;
|
||||
} else {
|
||||
return " $info";
|
||||
} },
|
||||
CMDOPTNAME => sub { my $id = shift; ['span', ['@id', $id], @_] },
|
||||
CFGOPTTREE => sub { my ($name, $info, @children) = @_;
|
||||
['h3', ['@id', $name], "$name ($info)"],
|
||||
"\n", @children },
|
||||
GUIMENUCHOICE => sub { ['em', join(" \x{2192} ", @_)] },
|
||||
ITEMIZELIST => sub { ['ul', map { ['li', html_splice_p($_)], "\n" } @_] },
|
||||
USEREXAMPLE => sub { ['blockquote', ['p', ['kbd', @_]]], "\n" },
|
||||
VARLISTENTRY => sub { my ($termchildren, @itemchildren) = @_;
|
||||
['dt', @$termchildren],
|
||||
['dd', html_splice_p(@itemchildren)] },
|
||||
);
|
||||
|
||||
sub optiondesc
|
||||
{
|
||||
my ($pipe, $rules, $templates) = @_;
|
||||
my @ret;
|
||||
my $paragraph_text;
|
||||
|
||||
my $end_paragraph = sub {
|
||||
if (defined $paragraph_text) {
|
||||
push @ret, $templates->{SIMPARA}($paragraph_text);
|
||||
undef $paragraph_text;
|
||||
}
|
||||
};
|
||||
|
||||
while (defined($_) and /^ {12}/) {
|
||||
# ' Cookie maximum age (in days):'
|
||||
# ' -1 is use cookie's expiration date if any'
|
||||
# ' 0 is force expiration at the end of session, ignoring cookie's'
|
||||
# ' expiration date'
|
||||
# ' 1+ is use cookie's expiration date, but limit age to the given'
|
||||
# ' number of days'
|
||||
if (/^ {12}((?:%|[+-]?\d).*)$/) {
|
||||
$end_paragraph->();
|
||||
my @list_paragraphs;
|
||||
do {
|
||||
my $paragraph_text = "";
|
||||
do {
|
||||
$paragraph_text .= "$1\n";
|
||||
$_ = <$pipe>;
|
||||
} while (defined($_) and /^ {12}(\s+\S.*)$/);
|
||||
chomp $paragraph_text;
|
||||
push @list_paragraphs, $templates->{SIMPARA}($paragraph_text);
|
||||
} while (defined($_) and /^ {12}((?:%|[+-]?\d).*)$/);
|
||||
push @ret, $templates->{ITEMIZELIST}(@list_paragraphs);
|
||||
} elsif (/^ {12}\t(\d.*)$/) {
|
||||
$end_paragraph->();
|
||||
my @list_paragraphs;
|
||||
do {
|
||||
push @list_paragraphs, $templates->{SIMPARA}($1);
|
||||
$_ = <$pipe>;
|
||||
} while (defined($_) and /^ {12}\t(\d.*)$/);
|
||||
push @ret, $templates->{ITEMIZELIST}(@list_paragraphs);
|
||||
} elsif (/^ {12}\t(-.*)$/) {
|
||||
$end_paragraph->();
|
||||
push @ret, $templates->{USEREXAMPLE}($1);
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^ {12}\t(\w+)(\(.*\))\s+:\s+(\S.*)$/) {
|
||||
$end_paragraph->();
|
||||
my @list_paragraphs;
|
||||
my @remote_param_rules = (
|
||||
{ FIND => qr(\b(URL|text)\b),
|
||||
REPLACE => sub { $templates->{PARAMETER}($1) } },
|
||||
{ FIND => qr(\b(new-tab|new-window|openBrowser)\b),
|
||||
REPLACE => sub { $templates->{LITERAL}($1) } },
|
||||
);
|
||||
do {
|
||||
push @list_paragraphs, $templates->{SIMPARA}(
|
||||
$templates->{COMMAND}($1, apply_rules($2, \@remote_param_rules)),
|
||||
": $3");
|
||||
$_ = <$pipe>;
|
||||
} while (defined($_) and /^ {12}\t(\w+)(\(.*\))\s+:\s+(\S.*)$/);
|
||||
push @ret, $templates->{ITEMIZELIST}(@list_paragraphs);
|
||||
} elsif (/^ {12}(.*\S.*)$/) {
|
||||
$paragraph_text .= "$1\n";
|
||||
$_ = <$pipe>;
|
||||
} else {
|
||||
$end_paragraph->();
|
||||
$_ = <$pipe>;
|
||||
}
|
||||
}
|
||||
$end_paragraph->();
|
||||
return map { apply_rules($_, $rules) } @ret;
|
||||
}
|
||||
|
||||
sub cmdopt_id
|
||||
{
|
||||
no locale;
|
||||
my ($option) = @_;
|
||||
$option =~ s/^-+//;
|
||||
$option =~ s/([^A-Za-z0-9-.])/sprintf('_%u', ord($1))/ge;
|
||||
return "cmdopt:$option";
|
||||
}
|
||||
|
||||
sub convert_config
|
||||
{
|
||||
my ($outfh, $elinks, $option, $templates) = @_;
|
||||
local $_;
|
||||
|
||||
# The rules that apply to most of the output.
|
||||
# See &apply_rules for the format.
|
||||
my @shared_rules = (
|
||||
# files, commands, environment variables
|
||||
{ FIND => qr!"vi"!,
|
||||
REPLACE => sub { $templates->{COMMAND}("vi") } },
|
||||
{ FIND => qr!\b(xterm)\b!,
|
||||
REPLACE => sub { $templates->{COMMAND}($1) } },
|
||||
{ FIND => qr!((?:\$|\b)(?:EDITOR|FTP_PROXY|HOME|HTTP_PROXY|HTTPS_PROXY|MAILCAP|NNTPSERVER|NO_PROXY|TERM|WWW_HOME|X509_CLIENT_CERT))\b!,
|
||||
REPLACE => sub { $templates->{ENVAR}($1) } },
|
||||
{ FIND => qr!(~/\.elinks|/dev/urandom|/dev/zero|\bsetup\.h|\bmime\.types)\b!,
|
||||
REPLACE => sub { $templates->{FILENAME}($1) } },
|
||||
{ FIND => qr!\b(rename|fsync|strftime)\((\d+)\)!,
|
||||
REPLACE => sub { $templates->{MANLINK}($1, $2) } },
|
||||
|
||||
# the rest
|
||||
{ FIND => qr!\b(http[46]?://[\w./+-]+?)(\.?)$!,
|
||||
REPLACE => sub { $templates->{ULINK}($1, $1), $2 } },
|
||||
{ FIND => qr!(ELinks bug (\d+))!,
|
||||
REPLACE => sub { $templates->{ULINK}("http://bugzilla.elinks.cz/show_bug.cgi?id=$2", $1) } },
|
||||
{ FIND => qr!\b(ELinks)\b!,
|
||||
REPLACE => sub { $templates->{APPLICATION}($1) } },
|
||||
);
|
||||
|
||||
my @command_rules = (
|
||||
{ FIND => qr!(-default-mime-type text/html)!,
|
||||
REPLACE => sub { $templates->{USERINPUT}($1) } },
|
||||
|
||||
# This rule cannot be shared because the configuration option
|
||||
# documentation does not have the anchors for the links.
|
||||
{ FIND => qr!(-?config-dir|-dump|-default-mime-type|-touch-files|-no-connect|-session-ring)!,
|
||||
REPLACE => sub { $templates->{LINK}(cmdopt_id($1), $1) } },
|
||||
|
||||
@shared_rules);
|
||||
|
||||
my @config_rules = (
|
||||
# non-ASCII characters
|
||||
{ FIND => qr!<->!, REPLACE => sub { "\x{2194}" } },
|
||||
{ FIND => qr!(\s)-(\s)!, REPLACE => sub { "$1\x{2013}$2" } },
|
||||
{ FIND => qr!(\s)---?(\s)!, REPLACE => sub { "$1\x{2014}$2" } },
|
||||
|
||||
# user interface
|
||||
{ FIND => qr!(Setup) -> (Terminal options)!,
|
||||
REPLACE => sub { $templates->{GUIMENUCHOICE}($1, $2) } },
|
||||
{ FIND => qr!\[ (Save) \]!,
|
||||
REPLACE => sub { $templates->{GUIBUTTON}($1) } },
|
||||
{ FIND => qr!\b(Goto URL)\b!,
|
||||
REPLACE => sub { $templates->{GUILABEL}($1) } },
|
||||
|
||||
# SGML
|
||||
{ FIND => qr!\b(ACCESSKEY|TABINDEX)\b!,
|
||||
REPLACE => sub { $templates->{SGMLATTR}($1) } },
|
||||
{ FIND => qr!\b(IMG)\b!,
|
||||
REPLACE => sub { $templates->{SGMLELEMENT}($1) } },
|
||||
{ FIND => qr!\b(alt)/(title)\b!,
|
||||
REPLACE => sub { $templates->{SGMLATTR}($1), "/", $templates->{SGMLATTR}($2) } },
|
||||
{ FIND => qr!\b(alt)( attribute)!,
|
||||
REPLACE => sub { $templates->{SGMLATTR}($1), $2 } },
|
||||
|
||||
# typography
|
||||
{ FIND => qr!\b_(not)_\b!,
|
||||
REPLACE => sub { $templates->{STRONG}($1) } },
|
||||
|
||||
# This rule cannot be shared because the command-line option
|
||||
# documentation does not have the anchors for the links.
|
||||
{ FIND => qr!\b(connection\.try_ipv6|cookies\.save|document\.browse\.minimum_refresh_time|document\.browse\.links\.color_dirs)\b!,
|
||||
REPLACE => sub { $templates->{LINK}($1, $1) } },
|
||||
|
||||
@shared_rules);
|
||||
|
||||
open my $pipe, "-|", $elinks, $option or die;
|
||||
my $version = <$pipe>;
|
||||
chomp $version;
|
||||
$version =~ s/^ELinks ([-.\w]+).*$/$1/ or die "unusual version: $version";
|
||||
my @nodes;
|
||||
$_ = <$pipe>;
|
||||
while (defined($_)) {
|
||||
if (/^$/) {
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^Configuration options:$/) {
|
||||
# The "Generated using" line is here at the top, because
|
||||
# DocBook XML does not allow anything else to follow a
|
||||
# refsect2 within a refsect1.
|
||||
push @nodes, $templates->{SIMPARA}(
|
||||
"Generated using output from ELinks version $version.");
|
||||
$_ = <$pipe>;
|
||||
while (defined($_)) {
|
||||
if (/^$/) {
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^ {2}(\S.*): \(([\w.-]+)\)$/) {
|
||||
# ' Browsing: (document.browse)'
|
||||
my ($tree_info, $tree_name) = ($1, $2);
|
||||
my @tree_nodes;
|
||||
$_ = <$pipe>;
|
||||
push @tree_nodes, optiondesc($pipe, \@config_rules, $templates);
|
||||
my @varlistentries;
|
||||
while (defined($_)) {
|
||||
if (/^$/) {
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^ {4}(\S+) (\S+) (\(.*)$/) {
|
||||
# ' cookies.save [0|1] (default: 1)'
|
||||
my ($optname, $opttype, $optdefault) = ($1, $2, $3);
|
||||
while ($optdefault =~ /^\([^"()]*"[^"]*$/s) {
|
||||
# a special hack for document.dump.separator,
|
||||
# which has newlines in the default value
|
||||
my $contline = <$pipe>;
|
||||
last unless defined($contline);
|
||||
chomp $contline;
|
||||
$optdefault .= "\n$contline";
|
||||
}
|
||||
$_ = <$pipe>;
|
||||
push @varlistentries, $templates->{CFGOPTENTRY}(
|
||||
$optname, $opttype, $optdefault,
|
||||
optiondesc($pipe, \@config_rules, $templates));
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
push @tree_nodes, $templates->{VARIABLELIST}(@varlistentries)
|
||||
if @varlistentries;
|
||||
push @nodes, $templates->{CFGOPTTREE}(
|
||||
$tree_name, $tree_info, @tree_nodes);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
} elsif (/^Usage:/) {
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^Options:$/) {
|
||||
$_ = <$pipe>;
|
||||
my @varlistentries;
|
||||
my $name_rules = [
|
||||
{ FIND => qr/([^,\s]+)/,
|
||||
REPLACE => sub { $templates->{CMDOPTNAME}(cmdopt_id($1), $1) } },
|
||||
];
|
||||
while (defined($_)) {
|
||||
if (/^$/) {
|
||||
$_ = <$pipe>;
|
||||
} elsif (/^ {4}(\S+(?:,\s+\S+)*)(?:\s+([\[<]\S*))?(?:\s+(\(.*\)))?\s*$/) {
|
||||
my @optnames = apply_rules($1, $name_rules);
|
||||
my (@opttype, @optinfo);
|
||||
@opttype = (" ", $templates->{CMDOPTTYPE}($2)) if defined($2);
|
||||
@optinfo = $templates->{CMDOPTINFO}($3) if defined($3);
|
||||
$_ = <$pipe>;
|
||||
push @varlistentries, $templates->{VARLISTENTRY}(
|
||||
[@optnames, @opttype, @optinfo],
|
||||
optiondesc($pipe, \@command_rules, $templates));
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
push @nodes, $templates->{VARIABLELIST}(@varlistentries)
|
||||
if @varlistentries;
|
||||
push @nodes, $templates->{SIMPARA}(
|
||||
"Generated using output from ELinks version $version.");
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
die "parsing stopped at $.: $_" if defined($_);
|
||||
xml_output($outfh, $_) foreach @nodes;
|
||||
}
|
||||
|
||||
GetOptions("help" => sub { pod2usage({-verbose => 1, -exitval => 0}) },
|
||||
"version" => \&show_version)
|
||||
or exit 2;
|
||||
print(STDERR "$0: wrong number of operands\n"), exit 2 if @ARGV != 2;
|
||||
my ($ELinks, $Outfname) = @ARGV;
|
||||
|
||||
my ($Option, $Templates);
|
||||
$Option = "--config-help" if $Outfname =~ m(config[^/]*$);
|
||||
$Option = "--long-help" if $Outfname =~ m(command[^/]*$);
|
||||
$Templates = \%TemplatesDocBook if $Outfname =~ m(xml[^/]*$);
|
||||
$Templates = \%TemplatesHTML if $Outfname =~ m(html[^/]*$);
|
||||
unless ($Option and $Templates) {
|
||||
print(STDERR "$0: name of output file does not indicate its content: $Outfname\n");
|
||||
exit 2;
|
||||
}
|
||||
open my $outfh, ">", $Outfname or die "$Outfname: $!\n";
|
||||
convert_config $outfh, $ELinks, $Option, $Templates;
|
||||
close $outfh or die "$Outfname: $!\n";
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
help2xml - Convert help output from ELinks to DocBook XML or XHTML.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<help2xml> F<.../src/elinks> F<.../option-command.frag.xml>
|
||||
|
||||
B<help2xml> F<.../src/elinks> F<.../option-config.frag.xml>
|
||||
|
||||
B<help2xml> F<.../src/elinks> F<.../option-command.frag.xhtml>
|
||||
|
||||
B<help2xml> F<.../src/elinks> F<.../option-config.frag.xhtml>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<help2xml> runs B<elinks --long-help> or B<elinks --config-help> to
|
||||
get the documentation of command-line or configuration options from
|
||||
the elinks executable, and converts it to a fragment of DocBook XML or
|
||||
XHTML. In the build system, these fragments are then included in the
|
||||
DocBook and XHTML versions of the L<elinks(1)> and L<elinks.conf(5)>
|
||||
manual pages.
|
||||
|
||||
=head1 ARGUMENTS
|
||||
|
||||
=over
|
||||
|
||||
=item F<.../src/elinks>
|
||||
|
||||
The B<elinks> executable file that B<help2xml> runs in order to
|
||||
get the documentation.
|
||||
|
||||
=item F<.../option-command.frag.xml>
|
||||
|
||||
=item F<.../option-config.frag.xml>
|
||||
|
||||
=item F<.../option-command.frag.xhtml>
|
||||
|
||||
=item F<.../option-config.frag.xhtml>
|
||||
|
||||
The output file to which B<help2docbook> writes the DocBook XML or
|
||||
XHTML fragment. The basename of this file must include the word
|
||||
"command" for command-line options, or "config" for configuration
|
||||
options. It must also include "xml" for Docbook XML, or "html" for
|
||||
XHTML.
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Kalle Olavi Niemitalo <kon@iki.fi>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (c) 2008 Kalle Olavi Niemitalo.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@ -77,7 +77,8 @@ init_perl(struct module *module)
|
||||
|
||||
/* PERL_SYS_INIT3 may not be defined, it depends on the system. */
|
||||
#ifdef PERL_SYS_INIT3
|
||||
char *my_argv[] = { NULL };
|
||||
char *my_argvec[] = { NULL, NULL };
|
||||
char **my_argv = my_argvec;
|
||||
int my_argc = 0;
|
||||
|
||||
/* A hack to prevent unused variables warnings. */
|
||||
|
@ -816,6 +816,7 @@ decode_terminal_escape_sequence(struct itrm *itrm, struct interlink_event *ev)
|
||||
case 'H': kbd.key = KBD_HOME; break; /* CUP khome cons25 */
|
||||
case 'I': kbd.key = KBD_PAGE_UP; break; /* (CHT) kpp cons25 */
|
||||
case 'G': kbd.key = KBD_PAGE_DOWN; break; /* (CHA) knp cons25 */
|
||||
case 'L': kbd.key = KBD_INS; break; /* (IL) kich1 cons25 */
|
||||
/* Free BSD (TERM=cons25 etc.) */
|
||||
/* case 'M': kbd.key = KBD_F1; break;*/ /* (DL) kf1 cons25 */
|
||||
case 'N': kbd.key = KBD_F2; break; /* (EF) kf2 cons25 */
|
||||
|
Loading…
Reference in New Issue
Block a user