summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-10-08 12:57:15 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-10-08 12:57:15 +0000
commit327ceeab8a33a93f5cc7c7a575dc0a7f398c3929 (patch)
tree4775a4896b10c5bbb4398bd060f81900af308e96 /Master/texmf/scripts/texdoc
parentb4ec7b8efbde2a4db34c31c10c77a625c1bc5e11 (diff)
texdoc 0.47 with support for manpages named .1.pdf and .5.pdf.
git-svn-id: svn://tug.org/texlive/trunk@15682 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts/texdoc')
-rwxr-xr-xMaster/texmf/scripts/texdoc/texdoc.tlu51
1 files changed, 30 insertions, 21 deletions
diff --git a/Master/texmf/scripts/texdoc/texdoc.tlu b/Master/texmf/scripts/texdoc/texdoc.tlu
index bef7fbbb281..e4e88c92782 100755
--- a/Master/texmf/scripts/texdoc/texdoc.tlu
+++ b/Master/texmf/scripts/texdoc/texdoc.tlu
@@ -29,10 +29,10 @@ Previous work in the public domain:
-- progname and version
progname = 'texdoc'
-version = '0.46'
+version = '0.47'
if string.sub(version, -1) == '+' then
local svnrev = string.match('$Rev$', '%$Rev:%s*(%d*)%s*%$');
- version = version..' svn r'..svnrev
+ version = svnrev and version..' svn r'..svnrev or version..' git'
end
-- make sure to update setup_config_from_cl() accordingly
@@ -101,7 +101,7 @@ place_holder = '%%s' -- used for viewer commands
-- everything works for them (look for support_zipped in the code).
-- If you use this feature, please let us know: if nobody uses it,
-- we'll drop it at some point.
-support_zipped = false
+support_zipped = true
-------------------------- general-use functions ---------------------------
@@ -308,29 +308,37 @@ end
---------------------------- selecting results -----------------------------
--- says if ext is 'good' according to ext_list
-function is_good_ext (ext)
- for e in list (config.ext_list) do
+-- says if file has a 'good' extenstion according to ext_list
+function check_ext(file, pattern)
+ local good_ext, exact_match = false, false
+ local l, pat = string.len(pattern) + 1, pattern..'.'
+ for e in list(config.ext_list) do
if e == '*' then
- return true
- elseif (e == '') and (not ext) then
- return true
- elseif ext == e then
- return true
+ good_ext = true
+ if string.sub(file, 1, l) == pat then exact_match = true end
+ elseif (e == '') then
+ if not string.find(file, '.', 1, true) then good_ext = true end
+ if file == pattern then exact_match = true end
+ else
+ if string.sub(file, -string.len(e)) == e then good_ext = true end
+ if file == pattern..'.'..e then exact_match = true end
end
end
- return false
+ return good_ext, exact_match
end
-- include a file in the *_docfiles lists if it "matches"
function process_file (file, pathfile, code, pattern)
- local base, ext = string.match(string.lower(file), '^(.*)%.(.*)$')
- if string.find(string.lower(pathfile), pattern, 1, no_regex)
- and is_good_ext (ext) then
- if (base == pattern) or (file == pattern) then
- table.insert(exact_docfiles, code_path (code, pathfile))
- else
- table.insert(rel_docfiles, code_path (code, pathfile))
+ file = string.lower(file)
+ local base, ext = string.match(file, '^(.*)%.(.*)$')
+ if string.find(string.lower(pathfile), pattern, 1, no_regex) then
+ local good_ext, exact_match = check_ext(file, pattern)
+ if good_ext then
+ if exact_match then
+ table.insert(exact_docfiles, code_path (code, pathfile))
+ else
+ table.insert(rel_docfiles, code_path (code, pathfile))
+ end
end
end
end
@@ -761,7 +769,8 @@ function setup_config_from_defaults()
if support_zipped then
set_config_elt('ext_list',
'pdf,pdf.gz,pdf.bz2, html,html.gz,html.bz2, txt,txt.gz,txt.bz2,'..
- 'dvi,dvi.gz,dvi.bz2, ps,ps.gz,ps.bz2, ,gz,bz2')
+ '1.pdf, 5.pdf'..
+ 'ps,ps.gz,ps.bz2, dvi,dvi.gz,dvi.bz2, ,gz,bz2')
set_config_ls {
unzip_gz = 'gzip -d -c ',
unzip_bz2 = 'bzip -d -c ',
@@ -769,7 +778,7 @@ function setup_config_from_defaults()
rm_dir = 'rmdir'
}
else
- set_config_elt('ext_list', 'pdf, html, txt, dvi, ps, ')
+ set_config_elt('ext_list', 'pdf, html, txt, 1.pdf, 5.pdf, ps, dvi, ')
end
end