summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-07-15 14:05:10 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-07-15 14:05:10 +0000
commit2e1f055f9e98f45fadbfd7f0872e8f87c38d1aa9 (patch)
treeb3c9f62aa6ee69a438c015f868307e2e9ebd502d /Master/texmf/scripts/texdoc
parente7203437ab0953f71380a1dd091a955c2ab32bee (diff)
texdoc update (now finds readme.* too, in particular readme.texlive)
git-svn-id: svn://tug.org/texlive/trunk@19468 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts/texdoc')
-rw-r--r--Master/texmf/scripts/texdoc/config.tlu2
-rw-r--r--Master/texmf/scripts/texdoc/constants.tlu2
-rw-r--r--Master/texmf/scripts/texdoc/score.tlu23
-rw-r--r--Master/texmf/scripts/texdoc/search.tlu9
4 files changed, 31 insertions, 5 deletions
diff --git a/Master/texmf/scripts/texdoc/config.tlu b/Master/texmf/scripts/texdoc/config.tlu
index d0534f2a8fc..82e7f0c0b08 100644
--- a/Master/texmf/scripts/texdoc/config.tlu
+++ b/Master/texmf/scripts/texdoc/config.tlu
@@ -516,7 +516,9 @@ function setup_config_from_defaults()
interact_switch = 'true',
machine_switch = 'false',
ext_list = 'pdf, html, txt, ps, dvi, ',
+ basename_list = 'readme',
badext_list = 'txt, ',
+ badbasename_list = 'readme',
verbosity_level = C.def_verbosity,
debug_list = '',
max_lines = '20',
diff --git a/Master/texmf/scripts/texdoc/constants.tlu b/Master/texmf/scripts/texdoc/constants.tlu
index 8441450e089..00ac5dead20 100644
--- a/Master/texmf/scripts/texdoc/constants.tlu
+++ b/Master/texmf/scripts/texdoc/constants.tlu
@@ -64,7 +64,9 @@ known_options = {
'machine_switch',
'alias_switch',
'ext_list',
+ 'basename_list',
'badext_list',
+ 'badbasename_list',
'verbosity_level',
'debug_list',
'lastfile_switch',
diff --git a/Master/texmf/scripts/texdoc/score.tlu b/Master/texmf/scripts/texdoc/score.tlu
index a902392876c..5e9916ab689 100644
--- a/Master/texmf/scripts/texdoc/score.tlu
+++ b/Master/texmf/scripts/texdoc/score.tlu
@@ -73,7 +73,7 @@ function set_score(df, original_kw)
elseif is_exact(name, p) then
s = pat.score or 10 -- default alias score
deb_print('score', string.format(
- "Matching alias '%s', score: %d", pat.name, s))
+ "Matching alias '%s', score: %g", pat.name, s))
end
if s > score then score = s end
end
@@ -95,7 +95,7 @@ function set_score(df, original_kw)
if val and is_subword('/'..name, pat) then
score = score + val
deb_print('score', string.format(
- "Adjust by '%d' from specific pattern '%s'", val, pat))
+ "Adjust by %g from specific pattern '%s'", val, pat))
end
end
end
@@ -105,7 +105,7 @@ function set_score(df, original_kw)
if val and is_subword('/'..name, pat) then
if score > -10 or val < 0 then score = score + val end
deb_print('score', string.format(
- "Adjust by '%d' from global pattern '%s'", val, pat))
+ "Adjust by %g from global pattern '%s'", val, pat))
end
end
end
@@ -154,11 +154,15 @@ function heuristic_score(file, pat)
end
end
end
- -- if extension is bad, score is < 0
+ -- if extension is bad, score gets < 0
local ext = config.ext_list[ext_pos(file)]
if ext and config.badext_list_inv[ext] and score > 0 then
upscore(-1, 'bad extension', true)
end
+ -- if basename is bad, score gets < 0
+ if has_bad_basename(file) and score > 0 then
+ upscore(-1, 'bad basename', true)
+ end
-- bonus for being in the right directory
if string.find('/'..file, '/'..pat..'/', 1, true) and not slash then
upscore(score + 0.5, 'directory bonus')
@@ -196,6 +200,17 @@ function is_delim(str, i)
return not not string.find(string.sub(str, i, i), '%p')
end
+-- say if a filename has a bad basename
+function has_bad_basename(file)
+ file = file:gsub('.*/', '')
+ for _, b in ipairs(config.badbasename_list) do
+ if file:find('^'..b..'$') or file:find('^'..b..'%.') then
+ return true
+ end
+ end
+ return false
+end
+
-- compare two docfile's: (see search.tlu for structure)
-- 1. by score
-- 2. then by extensions (ordered as in ext_list),
diff --git a/Master/texmf/scripts/texdoc/search.tlu b/Master/texmf/scripts/texdoc/search.tlu
index aa225b7fb46..fc74650e31a 100644
--- a/Master/texmf/scripts/texdoc/search.tlu
+++ b/Master/texmf/scripts/texdoc/search.tlu
@@ -332,7 +332,8 @@ function scan_db(patlist, code, lsr_db)
end
end
--- says if file has a 'good' extenstion according to ext_list
+-- says if file has a known extenstion according to ext_list
+-- (or known basename according to basename_list)
function check_ext(file)
file = string.lower(file)
-- remove zipext if applicable
@@ -352,6 +353,12 @@ function check_ext(file)
end
end
end
+ -- is the basename good?
+ for _, b in ipairs(config.basename_list) do
+ if file:find('^'..b..'$') or file:find('^'..b..'%.') then
+ return true
+ end
+ end
return false
end