/ [texdoc] / trunk / constants.tlu
To checkout: svn checkout http://svn.gnu.org.ua/sources/texdoc/trunk/constants.tlu
Puszcza

Annotation of /trunk/constants.tlu

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Thu Mar 2 10:41:29 2017 UTC (4 years, 10 months ago) by cereda
File size: 3969 byte(s)
First commit
1 cereda 2 -- constants.tlu: global "constants" for texdoc.
2     --
3     -- Manuel Pégourié-Gonnard, GPLv3, see texdoclib.tlu for details
4    
5     -- use an empty environment that will become texdoc_env.C (see EOF)
6     local constants = {}
7     local kpse = kpse
8     local setfenv = setfenv
9     local texdoc_env
10     if setfenv then
11     texdoc_env = getfenv()
12     setfenv(1, constants)
13     else
14     texdoc_env = _ENV
15     _ENV = constants
16     end
17    
18     -- BEGIN constants
19    
20     -- progname and version
21     fullname = kpse.find_file('texdoc/texdoclib', 'lua')
22     progname = 'texdoc'
23     version = '0.85'
24    
25     -- make sure to update setup_config_from_cl() accordingly
26     -- and set a default value in setup_config_from_defaults() if relevant
27     usage_msg = [[
28     Usage: texdoc [OPTION]... NAME...
29     or: texdoc ACTION
30    
31     Try to find appropriate TeX documentation for the specified NAME(s).
32     Alternatively, perform the given ACTION and exit.
33    
34     Current settings:
35    
36     Actions:
37     Options:
38     -w, --view Use view mode: start a viewer. (default)
39     -m, --mixed Use mixed mode (view or list).
40     -l, --list Use list mode: show a list of results.
41     -s, --showall Use showall mode: show also "bad" results.
42    
43     -i, --interact Use interactive menus. (default)
44     -I, --nointeract Use plain lists, no interaction required.
45     -M, --machine Machine-readable output for lists (implies -I).
46    
47     -q, --quiet Suppress warnings and most error messages.
48     -v, --verbose Print additional information (eg, viewer command).
49     -d, --debug[=list] Activate debug output (restricted to list).
50    
51     Environment: PAGER, BROWSER, PDFVIEWER, PSVIEWER, DVIVIEWER.
52     Files: <texmf>/texdoc/texdoc.cnf, see output of the --files option.
53     Report bugs to <texdoc@tug.org>.
54     Full manual available via `texdoc texdoc'.]]
55    
56     copyright_msg = [[
57     Copyright (C) 2008-2013 Manuel P'egouri'e-Gonnard.
58     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
59     This is free software: you are free to change and redistribute it.]]
60    
61     actions_ph = 'Actions:\n'
62    
63     usage_settings_ph = 'Current settings:' -- keep ../doc/texdoc wrapper in sync!
64     usage_settings = {
65     { name = 'mode', view = '--view', mixed = '--mixed', list = '--list',
66     showall = '--showall' },
67     { name = 'interact_switch',
68     [true] = '--interact', [false] = '--nointeract' },
69     }
70    
71     known_options = {
72     'viewer_.*',
73     'mode',
74     'interact_switch',
75     'machine_switch',
76     'ext_list',
77     'basename_list',
78     'badext_list',
79     'badbasename_list',
80     'suffix_list',
81     'verbosity_level',
82     'debug_list',
83     'lastfile_switch',
84     'rm_dir',
85     'rm_file',
86     'unzip_.*',
87     'zipext_list',
88     'max_lines',
89     'lang',
90     }
91    
92     error_msg = [[
93     Try `texdoc --help' for a short help, `texdoc texdoc' for the user manual.]]
94     notfound_msg = [[
95     Sorry, no documentation found for PKGNAME.
96     If you are unsure about the name, try searching CTAN's TeX catalogue at
97     http://ctan.org/search.html#byDescription.]]
98     notfound_msg_ph = 'PKGNAME'
99    
100     err_priority = {
101     error = 1,
102     warning = 2,
103     info = 3,
104     }
105     min_verbosity='0'
106     max_verbosity='3'
107     def_verbosity='2'
108    
109     known_debugs = {
110     version = {},
111     files = {},
112     config = {'files'},
113     view = {},
114     texdocs = {},
115     score = {},
116     tlpdb = {}
117     }
118    
119     -- various cache or non-cache files
120     cache_name = 'texdoc/cache-tlpdb.lua' -- relative to TEXMFVAR
121     data_tlpdb_name = 'texdoc/Data.tlpdb.lua'
122    
123     place_holder = '%%s' -- used for viewer commands
124    
125     -- END constants
126    
127     -- get our previous environment back
128     if setfenv then
129     setfenv(1, texdoc_env)
130     else
131     _ENV = texdoc_env
132     end
133    
134     -- Make global C a read-only proxy to the local <constants>.
135     -- Note this is not deep read-only: C.known_debugs is read-only, but
136     -- C.known_debugs.version isn't, for instance.
137     assert(next(C) == nil,
138     'Internal error: table of constants should be empty at this point')
139     setmetatable(C, {
140     __index = constants,
141     __newindew = function ()
142     error('Internal error: attempt to modify a constant.')
143     end
144     })

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20