summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc/score.tlu
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/score.tlu
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/score.tlu')
-rw-r--r--Master/texmf/scripts/texdoc/score.tlu23
1 files changed, 19 insertions, 4 deletions
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),