summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-02-24 00:25:19 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-02-24 00:25:19 +0000
commit6656d2306077966300b0abf8e3f43e595a751d2a (patch)
tree51bb60667411aa368985edd4ae710842fa30628f /Master
parent6ac194c6022aa3ae3716efae6a33d540954708ee (diff)
texdoc update
git-svn-id: svn://tug.org/texlive/trunk@17169 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf/doc/man/man1/texdoc.116
-rw-r--r--Master/texmf/doc/man/man1/texdoc.man1.pdfbin5506 -> 5462 bytes
-rw-r--r--Master/texmf/scripts/texdoc/config.tlu20
-rw-r--r--Master/texmf/scripts/texdoc/constants.tlu35
-rw-r--r--Master/texmf/scripts/texdoc/functions.tlu26
-rw-r--r--Master/texmf/scripts/texdoc/main.tlu5
6 files changed, 68 insertions, 34 deletions
diff --git a/Master/texmf/doc/man/man1/texdoc.1 b/Master/texmf/doc/man/man1/texdoc.1
index 56a0112a5c8..66c870e46ff 100644
--- a/Master/texmf/doc/man/man1/texdoc.1
+++ b/Master/texmf/doc/man/man1/texdoc.1
@@ -7,8 +7,6 @@ texdoc \- find & view documentation in TeX Live
[\fIOPTION\fR]... [\fINAME\fR]...
.SH DESCRIPTION
Try to find appropriate TeX documentation for the specified NAME(s).
-The default (view mode) is to display the documentation.
-.PP
With no NAME, print information about texdoc (\fB\-\-help\fR, \fB\-\-version\fR, \fB\-\-files\fR).
.TP
\fB\-h\fR, \fB\-\-help\fR
@@ -32,8 +30,14 @@ Use list mode: show a list of results.
\fB\-s\fR, \fB\-\-showall\fR
Use showall mode: show also "bad" results.
.TP
+\fB\-i\fR, \fB\-\-interact\fR
+Use interactive menus. (default)
+.TP
+\fB\-I\fR, \fB\-\-nointeract\fR
+Use plain lists, no interaction required.
+.TP
\fB\-M\fR, \fB\-\-machine\fR
-Machine\-readable output (list or showall modes).
+Machine\-readable output for lists (implies \fB\-I\fR).
.TP
\fB\-a\fR, \fB\-\-alias\fR
Use the alias table. (default)
@@ -41,12 +45,6 @@ Use the alias table. (default)
\fB\-A\fR, \fB\-\-noalias\fR
Don't use the alias table.
.TP
-\fB\-i\fR, \fB\-\-interact\fR
-Use interactive menus. (default)
-.TP
-\fB\-I\fR, \fB\-\-nointeract\fR
-Use plain lists, no interaction required.
-.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress warnings and most error messages.
.TP
diff --git a/Master/texmf/doc/man/man1/texdoc.man1.pdf b/Master/texmf/doc/man/man1/texdoc.man1.pdf
index 1e7e8adb0b9..7cd2597aa2c 100644
--- a/Master/texmf/doc/man/man1/texdoc.man1.pdf
+++ b/Master/texmf/doc/man/man1/texdoc.man1.pdf
Binary files differ
diff --git a/Master/texmf/scripts/texdoc/config.tlu b/Master/texmf/scripts/texdoc/config.tlu
index 475f2f71fbf..be82dbf72d1 100644
--- a/Master/texmf/scripts/texdoc/config.tlu
+++ b/Master/texmf/scripts/texdoc/config.tlu
@@ -11,7 +11,7 @@ load_env(L, {
'string', 'table', 'os', 'kpse', 'lfs', 'io',
'ipairs', 'pairs', 'tonumber', 'tostring', 'setmetatable', 'next', 'print',
'assert', 'error',
- 'err_print', 'win32_hook', 'deb_print',
+ 'err_print', 'win32_hook', 'deb_print', 'print_usage',
'confline_to_alias', 'confline_to_score',
'C',
'config',
@@ -49,6 +49,8 @@ function set_config_element (key, value, context)
if not is_known then config_warn(key, nil, context, true) return end
-- exit if key is already set (/!\ must test for nil, not false)
if not (config[key] == nil) then return nil end
+ -- record the source of the setting
+ real_set_config(key..'_src', context.src)
-- detect the type of the key
if string.match(key, '_list$') then
-- coma-separated list
@@ -143,7 +145,9 @@ function setup_config_from_cl(arg)
curr_arg = table.remove(arg,1)
-- special options
if (curr_arg == '-h') or (curr_arg == '--help') then
- print (C.usage_msg)
+ setup_config_from_files()
+ setup_config_from_defaults()
+ print_usage()
os.exit(C.exit_ok)
elseif (curr_arg == '-V') or (curr_arg == '--version') then
print (C.progname .. ' ' .. C.version )
@@ -449,6 +453,7 @@ function setup_config_from_defaults()
else -- generic Unix
set_config_ls {
viewer_dvi = guess_viewer {
+ {'xdvi', '(xdvi %s) &'},
{'evince', '(evince %s) &'},
{'okular', '(okular %s) &'},
{'kdvi', '(kdvi %s) &'},
@@ -459,7 +464,6 @@ function setup_config_from_defaults()
{'dvilx', '(dvilx %s) &'},
{'advi', '(advi %s) &'},
{'xdvik-ja', '(xdvik-ja %s) &'},
- {'xdvi', '(xdvi %s) &'},
{'see', '(see %s) &'}
},
viewer_html = guess_viewer {
@@ -475,18 +479,18 @@ function setup_config_from_defaults()
{'see', 'see'}
},
viewer_pdf = guess_viewer {
+ {'xpdf', '(xpdf %s) &'},
{'evince', '(evince %s) &'},
{'okular', '(okular %s) &'},
{'kpdf', '(kpdf %s) &'},
- {'xpdf', '(xpdf %s) &'},
{'acroread', '(xpdf %s) &'},
{'see', '(see %s) &'}
},
viewer_ps = guess_viewer {
+ {'gv', '(gv %s) &'},
{'evince', '(evince %s) &'},
{'okular', '(okular %s) &'},
{'kghostview', '(kghostview %s) &'},
- {'gv', '(gv %s) &'},
{'see', '(see %s) &'}
},
viewer_txt = guess_viewer {
@@ -518,10 +522,10 @@ end
-- the default value of config.alias_switch depends on the mode as follows
function alias_from_mode (mode) -- /!\ returns a string!
- if (mode == 'view') or (mode == 'mixed') or (mode == 'list') then
- return 'true'
- else
+ if (mode == 'regex') then
return 'false'
+ else
+ return 'true'
end
end
diff --git a/Master/texmf/scripts/texdoc/constants.tlu b/Master/texmf/scripts/texdoc/constants.tlu
index e7023815cf0..c31f8183fa2 100644
--- a/Master/texmf/scripts/texdoc/constants.tlu
+++ b/Master/texmf/scripts/texdoc/constants.tlu
@@ -23,10 +23,10 @@ usage_msg = [[
Usage: texdoc [OPTION]... [NAME]...
Try to find appropriate TeX documentation for the specified NAME(s).
-The default (view mode) is to display the documentation.
-
With no NAME, print information about texdoc (--help, --version, --files).
+Current settings:
+
-h, --help Print this help message.
-V, --version Print the version number.
-f, --files Print the list of configuration files used.
@@ -35,13 +35,13 @@ With no NAME, print information about texdoc (--help, --version, --files).
-m, --mixed Use mixed mode (view or list).
-l, --list Use list mode: show a list of results.
-s, --showall Use showall mode: show also "bad" results.
- -M, --machine Machine-readable output (list or showall modes).
-
- -a, --alias Use the alias table. (default)
- -A, --noalias Don't use the alias table.
-i, --interact Use interactive menus. (default)
-I, --nointeract Use plain lists, no interaction required.
+ -M, --machine Machine-readable output for lists (implies -I).
+
+ -a, --alias Use the alias table. (default)
+ -A, --noalias Don't use the alias table.
-q, --quiet Suppress warnings and most error messages.
-v, --verbose Print additional information (eg, viewer command).
@@ -52,13 +52,14 @@ Files: <texmf>/texdoc/texdoc.cnf, see output of the --files option.
Homepage: http://tug.org/texdoc/
Manual: displayed by `texdoc texdoc'.]]
-error_msg = [[
-Try `texdoc --help' for a short help, `texdoc texdoc' for the user manual.]]
-notfound_msg = [[
-Sorry, no documentation found for PKGNAME.
-If you are unsure about the name, try searching CTAN's TeX catalogue at
-http://ctan.org/search.html#byDescription.]]
-notfound_msg_ph = 'PKGNAME'
+usage_settings_ph = 'Current settings:' -- keep ../doc/texdoc wrapper in sync!
+usage_settings = {
+ { name = 'mode', view = '--view', mixed = '--mixed', list = '--list',
+ showall = '--showall' },
+ { name = 'interact_switch',
+ [true] = '--interact', [false] = '--nointeract' },
+ { name = 'alias_switch', [true] = '--alias', [false] = '--noalias' },
+}
known_options = {
'viewer_.*',
@@ -77,6 +78,14 @@ known_options = {
'zipext_list',
}
+error_msg = [[
+Try `texdoc --help' for a short help, `texdoc texdoc' for the user manual.]]
+notfound_msg = [[
+Sorry, no documentation found for PKGNAME.
+If you are unsure about the name, try searching CTAN's TeX catalogue at
+http://ctan.org/search.html#byDescription.]]
+notfound_msg_ph = 'PKGNAME'
+
err_priority = {
error = 1,
warning = 2,
diff --git a/Master/texmf/scripts/texdoc/functions.tlu b/Master/texmf/scripts/texdoc/functions.tlu
index e93debafffc..22d44c9336a 100644
--- a/Master/texmf/scripts/texdoc/functions.tlu
+++ b/Master/texmf/scripts/texdoc/functions.tlu
@@ -8,8 +8,8 @@ See texdoc.tlu for details.
local L = {}
load_env(L, {
'export_symbols',
- 'string', 'io', 'os',
- 'pairs', 'ipairs', 'tonumber',
+ 'string', 'io', 'os', 'table', 'tostring',
+ 'print', 'pairs', 'ipairs', 'tonumber',
'C',
'config',
})
@@ -91,10 +91,32 @@ function parse_zip(file)
return file, nil
end
+-- print a usage message, with the proper 'active values' line
+function print_usage()
+ local default, files = {}, {}
+ for _, param in ipairs(C.usage_settings) do
+ local display = param[config[param.name]]
+ if config[param.name..'_src'] == 'def' then
+ table.insert(default, display)
+ elseif config[param.name..'_src'] == 'file' then
+ table.insert(files, display)
+ end
+ end
+ def = table.concat(default, ', ')
+ conf = table.concat(files, ', ')
+ if not (def == '') then def = def..' (default)' end
+ if not (conf == '') then conf = conf..' (user config)' end
+ local sep = (def == '' or conf == '') and '' or '; '
+ local settings = C.usage_settings_ph..' '..def..sep..conf..'.'
+ local usage_msg = string.gsub(C.usage_msg, C.usage_settings_ph, settings)
+ print(usage_msg)
+end
+
-- finally export a few symbols
export_symbols(L, {
'err_print',
'deb_print',
'win32_hook',
'parse_zip',
+ 'print_usage',
})
diff --git a/Master/texmf/scripts/texdoc/main.tlu b/Master/texmf/scripts/texdoc/main.tlu
index cb105eabda3..de6d62d23e7 100644
--- a/Master/texmf/scripts/texdoc/main.tlu
+++ b/Master/texmf/scripts/texdoc/main.tlu
@@ -8,10 +8,11 @@ See texdoc.tlu for details.
local L = {}
load_env(L, {
'os',
- 'print', 'ipairs',
+ 'ipairs',
'arg',
'C',
'setup_config_and_alias',
+ 'print_usage',
'get_doclist',
'deliver_results',
})
@@ -21,7 +22,7 @@ setup_config_and_alias(arg)
-- make sure we actually have argument(s)
if not arg[1] then
- print(C.usage_msg)
+ print_usage()
os.exit(C.exit_usage)
end