mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Make elinks.conf(5) also be build from .txt files
This simplifies help2doc since it now just have to do one single thing with output of either --config-help or --long-help. The new manpage is not as fancy wrt. indentation and sub titles but it is more uniform and we get a HTML version. Generate options-{config,command}.txt with help2doc. Only conditionally check for API header files, to speed up execusion.
This commit is contained in:
parent
428783704a
commit
aa7d65fb79
17
doc/Makefile
17
doc/Makefile
@ -50,8 +50,9 @@ TXT_DOCS = \
|
||||
urlshortcuts.txt
|
||||
|
||||
GEN_TXT_DOCS = \
|
||||
command-options.txt \
|
||||
import-features.conf.txt \
|
||||
option-command.txt \
|
||||
option-config.txt \
|
||||
keymap-defaults.txt \
|
||||
keymap-actions.txt
|
||||
|
||||
@ -59,6 +60,7 @@ TXT_DOCS += $(GEN_TXT_DOCS)
|
||||
|
||||
HTML_DOCS-$(CONFIG_ASCIIDOC) += \
|
||||
elinks.1.html \
|
||||
elinks.conf.5.html \
|
||||
elinkskeys.5.html \
|
||||
hacking.html \
|
||||
manual.html
|
||||
@ -72,18 +74,20 @@ HTML_DOCS-$(CONFIG_POD2HTML) += \
|
||||
|
||||
MAN_DOCS-$(CONFIG_XMLTO) += \
|
||||
elinks.1 \
|
||||
elinks.conf.5 \
|
||||
elinkskeys.5
|
||||
|
||||
|
||||
# Only jw is used for generating PDF.
|
||||
PDF_DOCS-$(CONFIG_JW) += \
|
||||
manual.pdf
|
||||
|
||||
MAN_DOCS += elinks.conf.5
|
||||
|
||||
## API Docs
|
||||
#
|
||||
|
||||
ifneq ($(findstring api,$(MAKECMDGOALS)),)
|
||||
API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort)
|
||||
endif
|
||||
|
||||
define api_doc
|
||||
api/$(2).txt: $(1)
|
||||
@ -137,11 +141,8 @@ import-features.conf.txt: $(FEATURES) $(IMPORT_FEATURES_CONF)
|
||||
keymap-defaults.txt keymap-actions.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND)
|
||||
$(LOCALES) $(srcdir)tools/make-elinkskeys-manpage $(KBDBIND)
|
||||
|
||||
command-options.txt: $(ELINKS) $(HELP2DOC)
|
||||
$(LOCALES) $(HELP2DOC) --cmdoptions --elinks=$(ELINKS) > $@
|
||||
|
||||
elinks.conf.5: $(ELINKS) $(HELP2DOC)
|
||||
$(LOCALES) $(HELP2DOC) --elinksconf --elinks=$(ELINKS) > $@
|
||||
option-%.txt: $(ELINKS) $(HELP2DOC)
|
||||
$(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@
|
||||
|
||||
## Default build rules
|
||||
#
|
||||
|
@ -32,7 +32,7 @@ do not need to care about them. Note that this list is by no means complete
|
||||
and it is not kept up-to-date. To get complete list of commandline options,
|
||||
start 'ELinks' with parameter `--help`.
|
||||
|
||||
include::command-options.txt[]
|
||||
include::option-command.txt[]
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
---------------------
|
||||
@ -150,7 +150,7 @@ was done by Jonas Fonseca mailto:fonseca@diku.dk[].
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
man:elinkskeys[5], elinks.conf(5), links(1), lynx(1), w3m(1), wget(1)
|
||||
man:elinkskeys[5], man:elinks.conf[5], links(1), lynx(1), w3m(1), wget(1)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
# vim: tabstop=4 shiftwidth=4 textwidth=76
|
||||
|
62
doc/elinks.conf.5.txt
Normal file
62
doc/elinks.conf.5.txt
Normal file
@ -0,0 +1,62 @@
|
||||
elinks.conf(5)
|
||||
==============
|
||||
|
||||
NAME
|
||||
----
|
||||
elinks.conf - ELinks configuration file
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
set "<option>" = <value>
|
||||
unset "<option>" = <value>
|
||||
bind "<keymap>" "<key>" = "<action>"
|
||||
include "<file>"
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
The `elinks.conf` file contains configuration information for ELinks. It can
|
||||
be used to configure the behaviour of ELinks in a wide variety of ways:
|
||||
protocol behaviour, keybindings, colors used for rendering and for the user
|
||||
interface.
|
||||
|
||||
It is read at startup and saved only when requested. All options described in
|
||||
this document can be fully configured from within ELinks so no editing of
|
||||
elinks.conf is needed.
|
||||
|
||||
Note that MIME-related options used for specifying handlers of various MIME
|
||||
types are NOT described in this document. Documentation for these options can
|
||||
be found at the ELinks homepage. Keybindings can also be specified in
|
||||
elinks.conf. This is described in the elinkskeys(5) man page.
|
||||
|
||||
SYNTAX
|
||||
------
|
||||
|
||||
The syntax of the configuration file is very simple. The elinks.conf file is a
|
||||
free-form ASCII text file. The file may contain extra tabs and newlines for
|
||||
formatting purposes. Keywords in the file are case-sensitive. Comments may be
|
||||
placed anywhere within the file (except within quotes). Comments begin with
|
||||
the # character and end at the end of the line.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
Some sample settings:
|
||||
|
||||
# Use asynchronous DNS resolver?
|
||||
set connection.async_dns = 1
|
||||
# horizontal text margin.
|
||||
set document.browse.margin_width = 3
|
||||
# Default document codepage.
|
||||
set document.codepage.assume = "ISO-8859-1"
|
||||
# User defined protocol handlers
|
||||
set protocol.user.mailto.unix = "mutt %h -s \e\*(lq%s\e\*(rq"
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
include::option-config.txt[]
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
man:elinks[1], man:elinkskeys[5]
|
@ -103,4 +103,4 @@ to asciidoc format and cleaned up by Jonas Fonseca.
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
man:elinks[1], elinks.conf(5)
|
||||
man:elinks[1], man:elinks.conf[5]
|
||||
|
@ -5,102 +5,25 @@
|
||||
# and hopefully other in the future.
|
||||
|
||||
# Updated by option handlind via --elinks=path/to/elinks option
|
||||
elinks="elinks"
|
||||
|
||||
# Utility functions {{{1
|
||||
|
||||
usage()
|
||||
{
|
||||
msg="$1"
|
||||
echo "$msg" >&2
|
||||
echo "`basename $0` ($script_version)" >&2
|
||||
echo "Usage: $0 [ --cmdoptions | --elinksconf | - | --elinks=path/to/elinks ]" >&2
|
||||
cat >&2 <<END_OF_USAGE
|
||||
--cmdoptions Print asciidoc markup with summary of the command options
|
||||
--elinksconf Print the elinks.conf.5 manpage
|
||||
- Read option info (elinks --config-help) from stdin
|
||||
--elinks=path Use the elinks program with the given path
|
||||
END_OF_USAGE
|
||||
exit -1
|
||||
}
|
||||
elinks="$1"
|
||||
option="$2"
|
||||
|
||||
# Option handling {{{1
|
||||
|
||||
command=
|
||||
filter=cat
|
||||
prev_option=
|
||||
|
||||
for option
|
||||
do
|
||||
# If the previous option needs an argument, assign it.
|
||||
if test -n "$prev_option"; then
|
||||
eval "$prev_option=\$option"
|
||||
prev_option=
|
||||
continue
|
||||
fi
|
||||
case "$option" in
|
||||
*command*)
|
||||
filter="sed 0,/^Options:/d"
|
||||
option=--long-help
|
||||
;;
|
||||
*config*)
|
||||
filter="sed 0,/^Configuration/d"
|
||||
option=--config-help
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$option" in
|
||||
--cmdoptions)
|
||||
command="$elinks -long-help"
|
||||
filter="sed 0,/^Options:/d"
|
||||
backend="cmdoptions"
|
||||
;;
|
||||
--elinksconf)
|
||||
command="$elinks -config-help"
|
||||
filter="sed 0,/^Configuration/d"
|
||||
backend="elinksconf"
|
||||
;;
|
||||
-)
|
||||
command="cat /dev/stdin"
|
||||
;;
|
||||
--elinks=*)
|
||||
elinks="`echo $option | sed -e 's/.*=//'`"
|
||||
;;
|
||||
*)
|
||||
usage "Unknown option"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$backend";
|
||||
then
|
||||
usage "No backend defined"
|
||||
fi
|
||||
|
||||
date_string=`date -I`
|
||||
script_version=`echo "\\$Revision: 1.19 $" | sed -e 's/\\$\(.*\) \\$/\1/'`
|
||||
elinks_version="`$elinks -version | head -n 1 | sed -e 's/ELinks \([0-9][^ ]*\).*/\1/'`"
|
||||
script_info="Generated by `basename $0` ($script_version) on $date_string"
|
||||
script_info="$script_info using output from ELinks version $elinks_version."
|
||||
dist_info="`basename $0` is distributed with ELinks under the terms of the GPL."
|
||||
|
||||
# Backends {{{1
|
||||
|
||||
print_header="print_${backend}_header"
|
||||
print_footer="print_${backend}_footer"
|
||||
print_description_end="print_${backend}_description_end"
|
||||
print_description_line="print_${backend}_description_line"
|
||||
print_option_tree="print_${backend}_option_tree"
|
||||
print_option_type="print_${backend}_option_type"
|
||||
|
||||
# --cmdoptions backend {{{2
|
||||
|
||||
print_cmdoptions_header()
|
||||
{
|
||||
echo
|
||||
}
|
||||
|
||||
print_cmdoptions_footer()
|
||||
{
|
||||
echo
|
||||
}
|
||||
|
||||
print_cmdoptions_description_end()
|
||||
{
|
||||
echo
|
||||
}
|
||||
|
||||
print_cmdoptions_description_line()
|
||||
print_description_line()
|
||||
{
|
||||
line="$1"
|
||||
number="$2"
|
||||
@ -124,12 +47,14 @@ print_cmdoptions_description_line()
|
||||
echo " $line"
|
||||
}
|
||||
|
||||
print_cmdoptions_option_tree()
|
||||
print_option_tree()
|
||||
{
|
||||
parse_description=
|
||||
title="$1"
|
||||
path="$2"
|
||||
echo "$path::"
|
||||
}
|
||||
|
||||
print_cmdoptions_option_type()
|
||||
print_option_type()
|
||||
{
|
||||
path="$1"
|
||||
typeid="$2"
|
||||
@ -153,130 +78,10 @@ print_cmdoptions_option_type()
|
||||
then
|
||||
typestring="$default"
|
||||
fi
|
||||
|
||||
echo "$typestring::"
|
||||
}
|
||||
|
||||
# --elinksconf backend {{{2
|
||||
|
||||
print_elinksconf_header()
|
||||
{
|
||||
cat << __END__
|
||||
.\" elinks.conf.5
|
||||
.\"
|
||||
.\" $script_info
|
||||
.\"
|
||||
.\" Copyleft (c) 2002-2004 The ELinks project
|
||||
.\"
|
||||
.\" This file may be distributed under the terms of the GNU
|
||||
.\" General Public License. <www.gnu.org/licenses/gpl.html>
|
||||
.\"
|
||||
.\" Process this file with groff -man -Tascii elinks.conf.5
|
||||
.TH ELINKS.CONF 5 "ELinks configuration file" "$date_string" "ELinks configuration file"
|
||||
|
||||
.SH NAME
|
||||
elinks.conf \- ELinks configuration file
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The
|
||||
.B elinks.conf
|
||||
file contains configuration information for ELinks. It can be used to configure
|
||||
the behaviour of ELinks in a wide variety of ways: protocol behaviour,
|
||||
keybindings, colors used for rendering and for the user interface.
|
||||
.PP
|
||||
It is read at startup and saved only when requested. All options described in
|
||||
this document can be fully configured from within ELinks so no editing of
|
||||
elinks.conf is needed.
|
||||
.PP
|
||||
Note that MIME-related options used for specifying handlers of various MIME
|
||||
types are NOT described in this document. Documentation for these options can be
|
||||
found at the ELinks homepage. Keybindings can also be specified in elinks.conf.
|
||||
This is described in the elinkskeys(5) man page.
|
||||
|
||||
.SH SYNTAX
|
||||
.PP
|
||||
The syntax of the configuration file is very simple. The elinks.conf file is a
|
||||
free-form ASCII text file. The file may contain extra tabs and newlines for
|
||||
formatting purposes. Keywords in the file are case-sensitive. Comments may be
|
||||
placed anywhere within the file (except within quotes). Comments begin with the
|
||||
# character and end at the end of the line.
|
||||
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
Some sample settings:
|
||||
.IP
|
||||
.nf
|
||||
# Use asynchronous DNS resolver?
|
||||
set connection.async_dns = 1
|
||||
# horizontal text margin.
|
||||
set document.browse.margin_width = 3
|
||||
# Default document codepage.
|
||||
set document.codepage.assume = "ISO-8859-1"
|
||||
# User defined protocol handlers
|
||||
set protocol.user.mailto.unix = "mutt %h -s \e\*(lq%s\e\*(rq"
|
||||
|
||||
.SH OPTIONS
|
||||
__END__
|
||||
}
|
||||
|
||||
elinks=
|
||||
|
||||
print_elinksconf_footer()
|
||||
{
|
||||
version="$1"
|
||||
echo ".SH \"DOCUMENT INFO\""
|
||||
echo ".PP"
|
||||
echo "$script_info"
|
||||
echo "$dist_info"
|
||||
echo ".SH \"SEE ALSO\""
|
||||
echo ".BR elinks (1),"
|
||||
echo ".BR elinkskeys (5)"
|
||||
}
|
||||
|
||||
print_elinksconf_description_end()
|
||||
{
|
||||
if test -n "$parse_int_option";
|
||||
then
|
||||
echo ".PD"
|
||||
echo ".RE"
|
||||
fi
|
||||
}
|
||||
|
||||
print_elinksconf_description_line()
|
||||
{
|
||||
line="$1"
|
||||
number="$2"
|
||||
if test -n "$number";
|
||||
then
|
||||
if test "$parse_int_option" = "1";
|
||||
then
|
||||
echo ".RS"
|
||||
echo ".PD 0"
|
||||
parse_int_option=2
|
||||
fi
|
||||
|
||||
echo ".TP"
|
||||
echo ".B $number"
|
||||
fi
|
||||
|
||||
echo "$line"
|
||||
}
|
||||
|
||||
print_elinksconf_option_tree()
|
||||
{
|
||||
title="$1"
|
||||
path="$2"
|
||||
echo ".SS $title ($path)"
|
||||
}
|
||||
|
||||
print_elinksconf_option_type()
|
||||
{
|
||||
path="$1"
|
||||
typeid="$2"
|
||||
default="$3"
|
||||
echo ".TP"
|
||||
echo "\\f3$path\\f2 $typeid\\f1 ($default)"
|
||||
}
|
||||
|
||||
# The main loop {{{1
|
||||
|
||||
@ -285,9 +90,7 @@ parse_description=
|
||||
parse_int_option=
|
||||
use_log=
|
||||
|
||||
$print_header
|
||||
|
||||
$command | $filter | while read line
|
||||
"$elinks" $option | $filter | while read line
|
||||
do
|
||||
if test -n "$parse_description"
|
||||
then
|
||||
@ -295,7 +98,6 @@ do
|
||||
# the desciption is over.
|
||||
if test -z "$line"
|
||||
then
|
||||
$print_description_end
|
||||
parse_description=
|
||||
parse_int_option=
|
||||
continue
|
||||
@ -318,7 +120,7 @@ do
|
||||
esac
|
||||
fi
|
||||
|
||||
$print_description_line "$line" "$number"
|
||||
print_description_line "$line" "$number"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -329,7 +131,7 @@ do
|
||||
parse_description=1
|
||||
title="`echo $line | sed -e 's/\([A-Z]*\):.*/\1/'`"
|
||||
path="`echo $line | sed -e 's/.*: (\([a-z_].*\))/\1/'`"
|
||||
$print_option_tree "$title" "$path"
|
||||
print_option_tree "$title" "$path"
|
||||
;;
|
||||
|
||||
[a-z_-]*[.a-z_-]*)
|
||||
@ -337,7 +139,7 @@ do
|
||||
path="`echo $line | sed -e 's/\([a-z-][^ ]*\).*/\1/'`"
|
||||
typeid="`echo $line | sed -e 's/[ ]*[a-z-][^ ]* \([^ ]*\).*/\1/'`"
|
||||
default="`echo \"$line\" | sed -e 's/[^(]*(\(.*\))/\1/'`"
|
||||
$print_option_type "$path" "$typeid" "$default"
|
||||
print_option_type "$path" "$typeid" "$default"
|
||||
if test "$typeid" = "<num>";
|
||||
then
|
||||
parse_int_option=1
|
||||
@ -349,6 +151,8 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
$print_footer
|
||||
version="`$elinks -version | head -n 1 | sed -e 's/ELinks \([0-9][^ ]*\).*/\1/'`"
|
||||
echo "Generated using output from ELinks version $version."
|
||||
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4
|
||||
|
Loading…
x
Reference in New Issue
Block a user