summaryrefslogtreecommitdiff
path: root/support/texdoc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-11 03:02:52 +0000
committerNorbert Preining <norbert@preining.info>2024-03-11 03:02:52 +0000
commitd0e99dfc632984d24851f9160409ef583a011f48 (patch)
treec4135f83059d24d568e89d91b17d94d64dc4f371 /support/texdoc
parent0977b5581b838e81912bc5f34fff3672359e236a (diff)
CTAN sync 202403110302
Diffstat (limited to 'support/texdoc')
-rw-r--r--support/texdoc/NEWS7
-rw-r--r--support/texdoc/README.md2
-rw-r--r--support/texdoc/doc/texdoc.12
-rw-r--r--support/texdoc/doc/texdoc.pdfbin89528 -> 89531 bytes
-rw-r--r--support/texdoc/doc/texdoc.tex4
-rw-r--r--support/texdoc/script/texdoclib-config.tlu2
-rw-r--r--support/texdoc/script/texdoclib-const.tlu4
-rw-r--r--support/texdoc/script/texdoclib-score.tlu12
-rw-r--r--support/texdoc/script/texdoclib-view.tlu138
-rw-r--r--support/texdoc/script/texdoclib.tlu2
-rw-r--r--support/texdoc/texdoc.cnf5
11 files changed, 111 insertions, 67 deletions
diff --git a/support/texdoc/NEWS b/support/texdoc/NEWS
index 6690f09e0e..89f7036ae5 100644
--- a/support/texdoc/NEWS
+++ b/support/texdoc/NEWS
@@ -2,6 +2,13 @@ NEWS for Texdoc
===============
(This file public domain.)
+Version 4.1 (2024-03-10)
+========================
+Release for TeX Live 2024.
+- CLI update: 10 results (configurable via "max_lines") are displayed even if there are many results
+- Some bug fixes and improvements
+- Scoring adjustments
+
Version 4.0.2 (2024-02-02)
--------------------------
- Improve the option parser
diff --git a/support/texdoc/README.md b/support/texdoc/README.md
index 57fa31a485..c52807387b 100644
--- a/support/texdoc/README.md
+++ b/support/texdoc/README.md
@@ -104,7 +104,7 @@ More specific information, such as the TODO list of this project and some inform
## Copyright and License
-Copyright 2008-2023 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
This package is distributed under the terms of the GNU General Public License as published by the Free Software Foundation, either [version 3](./COPYING) of the License, or (at your option) any later version.
diff --git a/support/texdoc/doc/texdoc.1 b/support/texdoc/doc/texdoc.1
index a1fc051ce2..afebf84286 100644
--- a/support/texdoc/doc/texdoc.1
+++ b/support/texdoc/doc/texdoc.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "TEXDOC" "1" "February 2024" "Texdoc 4.0.2" "Texdoc manual"
+.TH "TEXDOC" "1" "March 2024" "Texdoc 4.1" "Texdoc manual"
.
.SH "NAME"
\fBtexdoc\fR \- find & view documentation in TeX Live
diff --git a/support/texdoc/doc/texdoc.pdf b/support/texdoc/doc/texdoc.pdf
index 619e62907e..a9459182ac 100644
--- a/support/texdoc/doc/texdoc.pdf
+++ b/support/texdoc/doc/texdoc.pdf
Binary files differ
diff --git a/support/texdoc/doc/texdoc.tex b/support/texdoc/doc/texdoc.tex
index 56b5b40b11..ec9e0270ba 100644
--- a/support/texdoc/doc/texdoc.tex
+++ b/support/texdoc/doc/texdoc.tex
@@ -8,7 +8,7 @@
\subtitle{Find \& view documentation in \TL}
\pkgurl{https://tug.org/texdoc/}
\author{Manuel Pégourié-Gonnard\and Takuto Asakura}
-\date{v4.0.2\quad \today}
+\date{v4.1\quad \today}
\begin{document}
@@ -673,7 +673,7 @@ and |all| to activate all of these. Implies |--verbose|. Debug information are
printed on standard error.
\end{confitem}
-\begin{confitem}{max\_lines}{\meta{number}}[default: \code{20}]
+\begin{confitem}{max\_lines}{\meta{number}}[default: \code{10}]
Set the maximum number of results to be printed without confirmation in list,
mixed or showall mode. This setting has no effect if interaction is disabled.
\end{confitem}
diff --git a/support/texdoc/script/texdoclib-config.tlu b/support/texdoc/script/texdoclib-config.tlu
index ad9f852ea7..881a556805 100644
--- a/support/texdoc/script/texdoclib-config.tlu
+++ b/support/texdoc/script/texdoclib-config.tlu
@@ -592,7 +592,7 @@ local function setup_config_from_defaults()
suffix_list = '',
verbosity_level = C.def_verbosity,
debug_list = '',
- max_lines = '20',
+ max_lines = '10',
fuzzy_level = '3',
online_url = 'https://texdoc.org/serve/PKGNAME/0',
}
diff --git a/support/texdoc/script/texdoclib-const.tlu b/support/texdoc/script/texdoclib-const.tlu
index 1088c25e5e..5a6b8256d3 100644
--- a/support/texdoc/script/texdoclib-const.tlu
+++ b/support/texdoc/script/texdoclib-const.tlu
@@ -22,8 +22,8 @@ end
-- progname and version
fullname = kpse.find_file('texdoc/texdoclib', 'lua')
progname = 'Texdoc'
-version = '4.0.2'
-release_date = '2024-02-02'
+version = '4.1'
+release_date = '2024-03-10'
-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
diff --git a/support/texdoc/script/texdoclib-score.tlu b/support/texdoc/script/texdoclib-score.tlu
index 11befc7ed9..3fcccf8788 100644
--- a/support/texdoc/script/texdoclib-score.tlu
+++ b/support/texdoc/script/texdoclib-score.tlu
@@ -213,8 +213,15 @@ local function set_score(df, original_kw)
-- bonus for locale
local config_lang = texdoc.config.get_value('lang')
if not is_alias then
- local file_lang = df.lang
+ local file_lang
+ -- from its catalogue
+ if df.lang then
+ -- take first two letters; it may have country codes
+ file_lang = df.lang:sub(1, 2)
+ end
+
+ -- from its filename
if not file_lang then
_, file_lang, _ = parse(name)
file_lang = texdoc.const.lang_codes[file_lang]
@@ -225,7 +232,8 @@ local function set_score(df, original_kw)
dbg_score('Locale match bonus: +1.0')
elseif file_lang ~= nil and file_lang ~= 'en' then
-- normally, english documents do not have file_lang,
- -- but sometimes the catalog includes en info (e.g., geometry)
+ -- but sometimes catalogue includes en info (e.g., geometry)
+ -- we want to treat both cases similar
score = score - 0.1
dbg_score('Locale unmatch: -0.1')
end
diff --git a/support/texdoc/script/texdoclib-view.tlu b/support/texdoc/script/texdoclib-view.tlu
index 3bf6860a35..15fd5c940b 100644
--- a/support/texdoc/script/texdoclib-view.tlu
+++ b/support/texdoc/script/texdoclib-view.tlu
@@ -161,76 +161,101 @@ end
----------------------------- display results -----------------------------
+-- length of the list to be shown
+local function count_list_length(doclist, showall)
+ local res = 0
+ for _, doc in pairs(doclist) do
+ if doc:get_quality() == 'good' or
+ (showall and doc:get_quality() ~= 'killed') then
+ res = res + 1
+ end
+ end
+ return res
+end
+
+-- parse user response and view the file
+local function view_selected_doc(doclist, num_str, last_i)
+ -- That returns the empty string on an empty line, nil on EOF.
+ -- We only want to default to viewing 1 on an empty line.
+ -- Use Lua's faked ternary operator for fun and brevity:
+ num = (num_str == '' and 1 or tonumber(num_str))
+ if num and doclist[num] and num <= last_i then
+ view_doc(doclist[num])
+ end
+end
+
-- print a list of docfile objects (see texdoclib-search.tlu) as a menu
-- if showall is false, stop as soon as a bad result is encountered
-local function print_menu(name, doclist, showall)
+local function print_doclist(name, doclist, showall)
local max_lines = tonumber(texdoc.config.get_value('max_lines'))
- if texdoc.config.get_value('interact_switch') and doclist[max_lines + 1] then
- -- there may be too many lines, count them
- local n = 0
- for _, doc in pairs(doclist) do
- if doc:get_quality() == 'good' or
- (showall and doc:get_quality() ~= 'killed') then
- n = n + 1
- end
- end
+ local interact = texdoc.config.get_value('interact_switch')
+
+ local last_i = 0
+ local prompt_more = false
+
+ local len = count_list_length(doclist, showall)
+ if interact and len > max_lines then
+ local msg = '%d results. Only the top %d are shown below.'
+ print(msg:format(len, max_lines))
+ prompt_more = true
+ elseif len == 0 then -- nothing to show
+ return last_i
+ end
- if n > max_lines then
- io.write(n, ' results. Display them all? (y/N) ')
- local ans = io.read('*line')
- if not ((ans == 'y') or (ans == 'Y')
- -- io.read had a bug wrt windows eol on some versions of texlua
- or (ans == '\ry') or (ans == '\rY')) then
- return
+ for i, doc in ipairs(doclist) do
+ if doc:get_quality() == 'killed' then break end
+ if doc:get_quality() ~= 'good' and not showall then break end
+
+ last_i = i -- save for testing
+ if texdoc.config.get_value('machine_switch') == true then
+ -- for machine-readable output, list all results in a certain format
+ print(name, doc.score, texdoc.util.w32_path(doc.realpath),
+ doc.lang or '', doc.details or '')
+ else
+ print(string.format('%2d %s', i, texdoc.util.w32_path(doc.realpath)))
+ if doc.details or doc.lang then
+ local line = ' = '
+ if doc.lang then line = line .. '[' .. doc.lang .. '] ' end
+ if doc.details then line = line .. doc.details end
+ print(line)
end
- end
- end
- local last_i
- while true do
- for i, doc in ipairs(doclist) do
- if doc:get_quality() == 'killed' then break end
- if doc:get_quality() ~= 'good' and not showall then break end
-
- last_i = i -- save for test below
- if texdoc.config.get_value('machine_switch') == true then
- print(name, doc.score, texdoc.util.w32_path(doc.realpath),
- doc.lang or '', doc.details or '')
- else
- print(string.format('%2d %s', i, texdoc.util.w32_path(doc.realpath)))
- if doc.details or doc.lang then
- local line = ' = '
- if doc.lang then line = line .. '[' .. doc.lang .. '] ' end
- if doc.details then line = line .. doc.details end
- print(line)
+
+ if i >= max_lines and prompt_more then
+ io.write('Enter number of file to view, RET to view 1, S to show all results, ' ..
+ 'or any other key to exit: ')
+ local ans = io.read('*line')
+ if ans == 'S' then
+ prompt_more = false -- and continue this loop
+ else
+ view_selected_doc(doclist, ans, last_i)
+ return last_i -- which should be always positive
end
end
end
+ end
- if last_i or showall then
- break
- else
- err_print('warning', 'No good result found, showing all results.')
- showall = true
- end
+ if interact then
+ io.write('Enter number of file to view, RET to view 1, anything else to skip: ')
+ view_selected_doc(doclist, io.read('*line'), last_i)
+ end
+
+ return last_i
+end
+
+-- wrapper function for print_doclist(): we could call it twice
+local function print_list_menu(name, doclist, showall)
+ local last_i = print_doclist(name, doclist, showall)
+
+ if not showall and last_i == 0 then
+ err_print('warning', 'No good result found, showing all results.')
+ last_i = print_doclist(name, doclist, true)
end
- if not last_i then
+ if last_i == 0 then
local msg = string.gsub(C.notfound_msg, C.notfound_msg_ph, name)
io.stderr:write(msg .. '\n') -- get rid of gsub's 2nd value
os.exit(C.exit_notfound)
end
-
- if texdoc.config.get_value('interact_switch') then
- io.write('Enter number of file to view, RET to view 1, anything else to skip: ')
- local num_str = io.read('*line')
- -- That returns the empty string on an empty line, nil on EOF.
- -- We only want to default to viewing 1 on an empty line.
- -- Use Lua's faked ternary operator for fun and brevity:
- num = (num_str == '' and 1 or tonumber(num_str))
- if num and doclist[num] and num <= last_i then
- view_doc(doclist[num])
- end
- end
end
local function search_online(name, doclist)
@@ -296,6 +321,7 @@ function M.deliver_results(name, doclist, many)
io.stderr:write(msg .. '\n') -- get rid of gsub's 2nd value
os.exit(C.exit_notfound)
end
+
-- shall we show all of them or only the "good" ones?
local mode = texdoc.config.get_value('mode')
@@ -310,7 +336,7 @@ function M.deliver_results(name, doclist, many)
if many and not texdoc.config.get_value('machine_switch') then
print('*** Results for: ' .. name .. ' ***')
end
- print_menu(name, doclist, mode == 'showall')
+ print_list_menu(name, doclist, mode == 'showall')
else
search_online(name, doclist)
end
diff --git a/support/texdoc/script/texdoclib.tlu b/support/texdoc/script/texdoclib.tlu
index 83c300833e..d2c7d8996a 100644
--- a/support/texdoc/script/texdoclib.tlu
+++ b/support/texdoc/script/texdoclib.tlu
@@ -1,7 +1,7 @@
-- texdoclib.tlu: the texdoc library
--[[
-Copyright 2008-2023 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/support/texdoc/texdoc.cnf b/support/texdoc/texdoc.cnf
index 980cb2dbf6..af409250d2 100644
--- a/support/texdoc/texdoc.cnf
+++ b/support/texdoc/texdoc.cnf
@@ -330,6 +330,7 @@ alias fontenc = source2e
alias textcomp = source2e
alias tracefnt = source2e
alias structuredlog = ltfilehook-doc
+alias xparse = usrguide
# TODO: try to avoid the huge amount of false positives for `doc' itself.
# latex-dev instruction
@@ -408,8 +409,10 @@ alias(5) mp = mpintro
# latex3 and friends
alias latex3 = ltx3info
-alias(3) expl3 = interface3
+alias expl3 = interface3
alias(3) expl3 = source3
+alias l3 = interface3
+alias(9) l3 = source3
alias l3bootstrap = interface3
alias l3names = interface3
alias l3basics = interface3