1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
-- Global "constants" for texdoc.
--[[
Copyright 2008, 2009 Manuel Pégourié-Gonnard
Distributed under the terms of the GNU GPL version 3 or later.
See texdoc.tlu for details.
--]]
local L = {}
load_env(L, {
'setmetatable', 'next', 'assert', 'error',
'C',
})
-- progname and version
progname = 'texdoc'
version = '0.50'
-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
usage_msg = [[
texdoc tries to find appropriate TeX documentation for the specified NAME(s).
With no NAME, it can print configuration information (-f, --files);
the usual --help and --version options are also accepted.
Usage: texdoc [OPTIONS]... [NAME]...
-f, --files Print the name of the config files being used.
-e, --extensions=L Require file extensions to be in the list L.
-w, --view Use view mode: start a viewer.
-m, --mixed Use mixed mode (view or list).
-l, --list Use list mode: don't start a viewer.
-s, --search Search for name as a substring.
-r, --regex Search for name as a lua regex.
-a, --alias Use the alias table.
-A, --noalias Don't use the alias table.
-i, --interact Use interactive menus.
-I, --nointeract Use plain lists, no interaction required.
-v, --verbosity=N Set verbosity level to N.
-d, --debug Set verbosity level to maximum.
-M, --machine Use a more machine-friendly output format.
Environment: PAGER, BROWSER, PDFVIEWER, PSVIEWER, DVIVIEWER.
Files: <texmf>/texdoc/texdoc.cnf files, see the -f 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'
known_options = {
'viewer_.*',
'mode',
'interact_switch',
'machine_switch',
'alias_switch',
'ext_list',
'verbosity_level',
'lastfile_switch',
'rm_dir',
'rm_file',
'unzip_.*',
'zipext_list',
}
err_priority = {
error = 1,
warning = 2,
info = 3,
debug1 = 4,
debug2 = 5,
debug3 = 6,
debug4 = 7,
debug5 = 8,
}
err_max = 8
place_holder = '%%s' -- used for viewer commands
-- zip/gz support
--
-- optionally, texdoc can support compressed documentation, but this is
-- system-dependant (commands for unzipping, temporary files, etc).
-- Since TeX Live doesn't ship compressed documentation, and I'm too lazy to
-- make zip support work reliably on all platforms, I don't turn into an
-- official option. However, it should work on Unix platforms.
--
-- If you enable zip support here, please check the configuration in config.tlu
-- (look for support_zipped). The zip command should write the unzipped file to
-- STDOUT. Check carefully that everything works as expected, since it got far
-- less testing than the rest of texdoc.
--
-- See also comments in texdoc.cnf about viewer settings.
support_zipped = false
-- make C a proxy to the local environment
assert(next(C) == nil,
'Internal error: table of constants should be empty at this point')
setmetatable(C, {
__index = L,
__newindew = function ()
error('Internal error: attempt to modify a constant.')
end
})
|