summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-13 13:21:12 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-13 13:21:12 +0000
commit723c1ff2d273f9024039153dc14e12181f2dd077 (patch)
tree624028a06e145c8b9c19f5ffa0982be6a50e70b5 /Master
parent3d71ca41b612a13560d04aaae74c689037b8a064 (diff)
add env var, change their priority and the way we use them
git-svn-id: svn://tug.org/texlive/trunk@9510 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/texdoc.tlu40
1 files changed, 19 insertions, 21 deletions
diff --git a/Master/texmf/scripts/texlive/texdoc.tlu b/Master/texmf/scripts/texlive/texdoc.tlu
index 0f12822ebdf..8fbe82e77c7 100755
--- a/Master/texmf/scripts/texlive/texdoc.tlu
+++ b/Master/texmf/scripts/texlive/texdoc.tlu
@@ -216,6 +216,16 @@ function set_config_list (conf)
end
end
+-- first, we shall make use of some environment variables
+set_config_list {
+ viewer_pdf = os.getenv ("PDFVIEWER"),
+ viewer_ps = os.getenv ("PSVIEWER"),
+ viewer_dvi = os.getenv ("DVIVIEWER"),
+ viewer_html = os.getenv ("BROWSER"),
+ viewer_tex = os.getenv ("PAGER"),
+ viewer_txt = os.getenv ("PAGER")
+}
+
-- initialize kpathsea
kpse.set_program_name(arg[-1], "texdoc")
@@ -249,11 +259,11 @@ function setup_config ()
local TEXMFHOME, TEXMFLOCAL
local platform, configfile, configfiles
local ext, command, default_viewer
-
+ --
platform=string.match(kpse.var_value('SELFAUTOLOC'), '.*/(.*)$')
TEXMFHOME=kpse.var_value('TEXMFHOME')
TEXMFLOCAL=kpse.var_value('TEXMFLOCAL')
-
+ --
-- the following config files are read if they exist.
configfiles={
TEXMFHOME ..'/texdoc/texdoc-'..platform..'.cnf',
@@ -261,29 +271,13 @@ function setup_config ()
TEXMFLOCAL..'/texdoc/texdoc-'..platform..'.cnf',
TEXMFLOCAL..'/texdoc/texdoc.cnf'
}
-
+ --
for i, configfile in ipairs(configfiles) do -- process all config files
debug ('processing "'..configfile..'"')
read_config_file(configfile)
end
end
-function get_viewer_from_env (variable)
- local viewer = os.getenv(variable)
- if viewer then
- return "("..viewer.." %s)"
- else
- return nil
- end
-end
-
--- with intermediate priority, we shall make use of some environment variables
-set_config_list {
- viewer_html = get_viewer_from_env ("BROWSER"),
- viewer_tex = get_viewer_from_env ("PAGER"),
- viewer_txt = get_viewer_from_env ("PAGER")
-}
-
-- for default viewer on general Unix, we use a list
-- and check in the path in order to find a suitable program
@@ -446,8 +440,12 @@ function try_viewing ()
"with the viewer_"..viewext" variable in texdoc.cnf.\n"..
"Please report the problem so we can add your viewer as a default.\n")
else
- view_command = string.gsub(
- config['viewer_'..viewext], '%%s',viewer_replacement)
+ if string.match (view_command, '%%s') then
+ view_command = string.gsub(
+ config['viewer_'..viewext], '%%s',viewer_replacement)
+ else
+ view_command = view_command..' '..viewer_replacement
+ end
if verbose then
print(view_command)
end