summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2025-02-11 20:48:39 +0000
committerKarl Berry <karl@freefriends.org>2025-02-11 20:48:39 +0000
commit4356c8e403eb556801f21442e0c1f5fff1d8449a (patch)
treed223cd650ff24a7a7965b94ccd6fe584d9806ce2 /Master
parent480fb4d6bc69e2cda37e981712c45d12426d65e6 (diff)
texdoc (11feb25)
git-svn-id: svn://tug.org/texlive/trunk@73876 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/man/man1/texdoc.168
-rw-r--r--Master/texmf-dist/doc/man/man1/texdoc.man1.pdfbin25530 -> 27415 bytes
-rw-r--r--Master/texmf-dist/doc/support/texdoc/NEWS7
-rw-r--r--Master/texmf-dist/doc/support/texdoc/README.md2
-rw-r--r--Master/texmf-dist/doc/support/texdoc/texdoc.pdfbin89531 -> 89566 bytes
-rw-r--r--Master/texmf-dist/doc/support/texdoc/texdoc.tex12
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-alias.tlu13
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-cli.tlu10
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-config.tlu3
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-const.tlu37
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-score.tlu8
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-search.tlu130
-rwxr-xr-xMaster/texmf-dist/scripts/texdoc/texdoclib-util.tlu1
-rw-r--r--Master/texmf-dist/scripts/texdoc/texdoclib.tlu2
-rw-r--r--Master/texmf-dist/texdoc/texdoc.cnf8
15 files changed, 181 insertions, 120 deletions
diff --git a/Master/texmf-dist/doc/man/man1/texdoc.1 b/Master/texmf-dist/doc/man/man1/texdoc.1
index afebf84286a..1cdc22ee420 100644
--- a/Master/texmf-dist/doc/man/man1/texdoc.1
+++ b/Master/texmf-dist/doc/man/man1/texdoc.1
@@ -1,185 +1,131 @@
-.\" generated with Ronn/v0.7.3
-.\" http://github.com/rtomayko/ronn/tree/0.7.3
-.
-.TH "TEXDOC" "1" "March 2024" "Texdoc 4.1" "Texdoc manual"
-.
+.\" generated with Ronn-NG/v0.10.1
+.\" http://github.com/apjanke/ronn-ng/tree/0.10.1
+.TH "TEXDOC" "1" "February 2025" "Texdoc 4.1.1" "Texdoc manual"
.SH "NAME"
\fBtexdoc\fR \- find & view documentation in TeX Live
-.
.SH "SYNOPSIS"
-\fBtexdoc\fR [OPTION]\.\.\. NAME\.\.\.
-.
+\fBtexdoc\fR [OPTION]\|\.\|\.\|\. NAME\|\.\|\.\|\.
.br
-\fBtexdoc\fR [OPTION]\.\.\. ACTION
-.
+\fBtexdoc\fR [OPTION]\|\.\|\.\|\. ACTION
.SH "DESCRIPTION"
Try to find appropriate TeX documentation for the specified NAME(s)\. Alternatively, perform the given ACTION and exit\.
-.
.SH "OPTIONS"
-.
.TP
\fB\-w\fR, \fB\-\-view\fR
Use view mode: start a viewer\. \fB(default)\fR
-.
.TP
\fB\-m\fR, \fB\-\-mixed\fR
Use mixed mode (view or list)\.
-.
.TP
\fB\-l\fR, \fB\-\-list\fR
Use list mode: show a list of results\.
-.
.TP
\fB\-s\fR, \fB\-\-showall\fR
Use showall mode: show also "bad" results\.
-.
.TP
\fB\-i\fR, \fB\-\-interact\fR
Use interactive menus\. \fB(default)\fR
-.
.TP
\fB\-I\fR, \fB\-\-nointeract\fR
Use plain lists, no interaction required\.
-.
.TP
\fB\-M\fR, \fB\-\-machine\fR
Machine\-readable output for lists (implies \-I)\.
-.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress warnings and most error messages\.
-.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print additional information (e\.g\., viewer command)\.
-.
.TP
\fB\-D\fR, \fB\-\-debug\fR
Activate all debug output (equal to "\-\-debug=all")\.
-.
.TP
\fB\-d\fR LIST, \fB\-\-debug\fR=LIST
Activate debug output restricted to the categories specified in LIST\.
-.
.br
-Available categories: \fBconfig\fR, \fBfiles\fR, \fBsearch\fR, \fBscore\fR, \fBtexdocs\fR, \fBtlpdb\fR, \fBversion\fR, \fBview\fR, and \fBall\fR to activate all of these\.
-.
+Available categories: \fBconfig\fR, \fBfiles\fR, \fBsearch\fR, \fBdocfile\fR, \fBscore\fR, \fBtexdocs\fR, \fBtlpdb\fR, \fBversion\fR, \fBview\fR, and \fBall\fR to activate all of these\.
.TP
\fB\-c\fR NAME=VALUE
Set configuration item NAME to VALUE\.
-.
.SH "ACTIONS"
-.
.TP
\fB\-h\fR, \fB\-\-help\fR
Print this help message\.
-.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print the version number\.
-.
.TP
\fB\-f\fR, \fB\-\-files\fR
Print the list of configuration files used\.
-.
.TP
\fB\-\-just\-view\fR FILE
Display FILE, given with full path (no searching)\.
-.
.TP
\fB\-\-print\-completion\fR SHELL
Print SHELL completion\.
-.
.SH "ENVIRONMENT"
The following environment variables can be split by colon and used to set viewers:
-.
.TP
\fBBROWSER\fR, \fBBROWSER_texdoc\fR
Set the command to be used for HTML documents\.
-.
.TP
\fBDVIVIEWER\fR, \fBDVIVIEWER_texdoc\fR
Set the command to be used for DVI documents\.
-.
.TP
\fBMDVIEWER\fR, \fBMDVIEWER_texdoc\fR
Set the command to be used for Markdown documents\.
-.
.TP
\fBPAGER\fR, \fBPAGER_texdoc\fR
Set the command to be used for text documents\.
-.
.TP
\fBPDFVIEWER\fR, \fBPDFVIEWER_texdoc\fR
Set the command to be used for PDF documents\.
-.
.TP
\fBPSVIEWER\fR, \fBPSVIEWER_texdoc\fR
Set the command to be used for PS documents\.
-.
.P
The following environment variables are also used:
-.
.TP
\fBLANG\fR, \fBLC_ALL\fR, \fBLANGUAGE\fR, \fBLANGUAGE_texdoc\fR
Set the locale, which will influence on the search results\.
-.
.TP
\fBTEXDOCS\fR
In addition to the documents included in the TeX Live database, Texdoc also searches documentation under TEXMF trees specified by the kpathsea variable \fBTEXDOCS\fR\.
-.
.SH "FILES"
\fB<texmf>/texdoc/texdoc\.cnf\fR, see output of the \fB\-\-files\fR option\.
-.
.SH "EXIT STATUS"
The \fBtexdoc\fR command exists with one of the following values:
-.
.TP
0
Success\.
-.
.TP
1
Internal error\.
-.
.TP
2
Usage error\.
-.
.TP
3
No documentation found\.
-.
.SH "REPORTING BUGS"
Report bugs to \fItexdoc@tug\.org\fR\.
-.
.br
Texdoc home page: \fIhttp://tug\.org/texdoc/\fR
-.
.br
Source: \fIhttps://github\.com/TeX\-Live/texdoc\fR
-.
.SH "COPYRIGHT"
-Copyright 2008\-2024 Manuel Pe\'gourie\'\-Gonnard, Takuto Asakura, the TeX Live Team\.
-.
+Copyright 2008\-2025 Manuel Pe'gourie'\-Gonnard, Takuto Asakura, the TeX Live Team\.
.br
License: GNU GPL version 3 or later \fIhttp://gnu\.org/licenses/gpl\.html\fR\.
-.
.br
This is free software: you are free to change and redistribute it\.
-.
.SH "SEE ALSO"
The full documentation is maintained as a PDF manual\. The command
-.
.IP "" 4
-.
.nf
-
texdoc texdoc
-.
.fi
-.
.IP "" 0
-.
.P
should give you access to the complete manual\.
diff --git a/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf b/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
index 3344fabe1e5..1c603cc25d7 100644
--- a/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/texdoc/NEWS b/Master/texmf-dist/doc/support/texdoc/NEWS
index 89f7036ae59..c3ba167b6a4 100644
--- a/Master/texmf-dist/doc/support/texdoc/NEWS
+++ b/Master/texmf-dist/doc/support/texdoc/NEWS
@@ -2,6 +2,13 @@ NEWS for Texdoc
===============
(This file public domain.)
+Version 4.1.1 (2025-02-11)
+--------------------------
+- New debug category "docfile"
+- Improve zsh completion function (by Markus Kurtz)
+- Some bug fixes and improvements
+- Scoring adjustments
+
Version 4.1 (2024-03-10)
========================
Release for TeX Live 2024.
diff --git a/Master/texmf-dist/doc/support/texdoc/README.md b/Master/texmf-dist/doc/support/texdoc/README.md
index c52807387be..abe8e729e07 100644
--- a/Master/texmf-dist/doc/support/texdoc/README.md
+++ b/Master/texmf-dist/doc/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-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 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/Master/texmf-dist/doc/support/texdoc/texdoc.pdf b/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
index a9459182acc..c986a90f9d1 100644
--- a/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
+++ b/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/texdoc/texdoc.tex b/Master/texmf-dist/doc/support/texdoc/texdoc.tex
index ec9e0270bab..6080db3fe70 100644
--- a/Master/texmf-dist/doc/support/texdoc/texdoc.tex
+++ b/Master/texmf-dist/doc/support/texdoc/texdoc.tex
@@ -1,6 +1,6 @@
%#!texfot xelatex
% Texdoc user manual
-% Copyright 2008-2024 Manuel Pégourié-Gonnard and Takuto Asakura
+% Copyright 2008-2025 Manuel Pégourié-Gonnard and Takuto Asakura
% distributed under the terms of GPL v3 or later
\documentclass{texdoc-doc}
@@ -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.1\quad \today}
+\date{v4.1.1\quad \today}
\begin{document}
@@ -668,9 +668,9 @@ recommended).
\begin{confitem}{debug\_list}{\meta{list}}[default: empty]
Set the list of activated debug categories. Available debug categories are
-|config|, |files|, |search|, |score|, |texdocs|, |tlpdb|, |version|, |view|,
-and |all| to activate all of these. Implies |--verbose|. Debug information are
-printed on standard error.
+|config|, |files|, |search|, |docfile|, |score|, |texdocs|, |tlpdb|, |version|,
+|view|, 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{10}]
@@ -795,7 +795,7 @@ our completion function with either of the following two ways:
\label{sec:licence}
The current version of Texdoc program and its documentation are copyright
-2008--2024 Manuel Pégourié-Gonnard, Takuto Asakura, the {\TL} Team.
+2008--2025 Manuel Pégourié-Gonnard, Takuto Asakura, the {\TL} Team.
They are 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/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu
index 09e6dacd0ab..3fcb12bff8f 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu
@@ -46,7 +46,7 @@ end
-- add an alias value for a key
local function add_alias(key, value, score)
- local k = string.lower(key)
+ local k = key:lower()
alias[k] = alias[k] or {make_alias(key, false)}
if alias[k].stop then return end
table.insert(alias[k], make_alias(value, score))
@@ -54,14 +54,14 @@ end
-- prevent a key from being further aliased
local function stop_alias(key)
- local k = string.lower(key)
+ local k = key:lower()
alias[k] = alias[k] or {}
alias[k].stop = true
end
-- get patterns for a name
function M.get_patterns(name, no_alias)
- local n = string.lower(name)
+ local n = name:lower()
-- get normal aliases
local res
@@ -92,21 +92,20 @@ end
-- interpret a confline as an alias setting or return false
function M.confline_to_alias(line)
-- alias directive without score
- local key, val = string.match(line, '^alias%s+([%w%p]+)%s*=%s*(.+)')
+ local key, val = line:match('^alias%s+([%w%p]+)%s*=%s*(.+)')
if key and val then
add_alias(key, val)
return true
end
-- alias directive with score
- local score, key, val = string.match(line,
- '^alias%(([%d+-.]+)%)%s+([%w%p]+)%s*=%s*(.+)')
+ local score, key, val = line:match('^alias%(([%d+-.]+)%)%s+([%w%p]+)%s*=%s*(.+)')
if score then score = tonumber(score) end
if key and val and score then
add_alias(key, val, score)
return true
end
-- stopalias directive
- local key = string.match(line, '^stopalias%s+(.+)')
+ local key = line:match('^stopalias%s+(.+)')
if key then
stop_alias(key)
return true
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
index 79c202600d3..84766a6bc66 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
@@ -58,14 +58,10 @@ local function getopt(arg, options)
end
-- check the existence of an argument
- if not tmp then
+ if not tmp or tmp:match('^%-') then
err_print('error',
'Option -%s requires an argument.', jopt)
os.exit(C.exit_error)
- end
-
- if tmp:match('^%-') then
- table.insert(tab, {jopt, false})
else
table.insert(tab, {jopt, tmp})
end
@@ -121,7 +117,7 @@ local function parse_options()
else
return true, option['long'], cl_config
end
- elseif option~=nil and option['group'] then
+ elseif option ~= nil and option['group'] then
if option['type'] == 'boolean' then
option['action'](cl_config, curr_arg)
elseif option['type'] == 'string' then
@@ -172,7 +168,7 @@ local function do_action(action)
texdoc.util.print_zsh_completion()
os.exit(C.exit_ok)
else
- err_print('error', arg[1] .. ' is not supported currently!')
+ err_print('error', arg[1] .. ' is currently not supported.')
os.exit(C.exit_error)
end
end
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
index 881a5568051..44b42dee963 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
@@ -152,7 +152,8 @@ function M.set_config_element(key, value, context)
-- special case: if we just set debug_list, print version info now
if key == 'debug_list' then
- dbg_print('version', '%s v%s', C.fullname, C.version)
+ local w32_path = import_function('util', 'w32_path')
+ dbg_print('version', '%s v%s', w32_path(C.fullname), C.version)
end
-- now tell what we have just done, for debugging
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
index 5a6b8256d3b..28fc1fee74e 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
@@ -22,8 +22,8 @@ end
-- progname and version
fullname = kpse.find_file('texdoc/texdoclib', 'lua')
progname = 'Texdoc'
-version = '4.1'
-release_date = '2024-03-10'
+version = '4.1.1'
+release_date = '2025-02-11'
-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
@@ -63,14 +63,26 @@ __texdoc() {
+ debug
{{debug}}
)
- _arguments -C -A $options \
- '*: :->arguments' && return
- case $state in
- arguments)
- local tlpdb="$(kpsewhich -var-value TEXMFROOT)/tlpkg/texlive.tlpdb"
- _values package $(awk '/^name[^.]*$/ {print $2}' $tlpdb)
- ;;
- esac
+ _arguments -C -A $options '*:document:__texdoc_argument'
+}
+
+__texdoc_argument() {
+ _alternative \
+ "files:local documents:$(__texdoc_massage __texdoc_localfiles)" \
+ "aliases:aliases:$(__texdoc_massage __texdoc_aliases)" \
+ "packages:packages:$(__texdoc_massage __texdoc_packages)" \
+ "pdf:documents:$(__texdoc_massage __texdoc_lsr pdf)" \
+}
+
+# stdout of $@ is split at linebreaks, ordered, element-wise quoted, space joined, and ripped of empty words
+__texdoc_massage() { echo \(${(j: :)${(@q)${(ou)${(f)"$($@ 2>/dev/null)"}}}:#"''"}\) }
+
+__texdoc_localfiles() { find -L "$(kpsewhich -var-value TEXMFHOME)/doc" -type f -printf '%f\n' }
+__texdoc_aliases() { sed -n 's/^alias[^ ]* \(.*\) = .*$/\1/p' "${(f@)"$(texdoc --files|sed -n 's/^\s\+active\s\+//p')"}" }
+__texdoc_lsr() { grep -h "\\.$1$" "${(f@)"$(kpsewhich -all ls-R)"}" }
+__texdoc_packages() { # Use texlive.tlpdb if it exists, otherwise fallback to texdoc's own data
+ sed -n '/\./!s/^name //p' "${(f@)"$(kpsewhich -all -cnf-line='TEXINPUTS={$TEXMFROOT,$TEXMFHOME}/tlpkg' -format=tex texlive.tlpdb)"}" \
+ || sed -n 's/^ \["\([^"]*\)"\] = {$/\1/p' "$(kpsewhich Data.tlpdb.lua)"
}
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
@@ -268,7 +280,7 @@ options = {
}
copyright_msg = [[
-Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.]]
@@ -355,10 +367,13 @@ min_verbosity = '0' -- (nothing at all)
max_verbosity = '3'
def_verbosity = '2'
+-- debug categories
+-- the listed categories in the values are automatically activated
known_debugs = {
config = {'files'},
files = {},
search = {},
+ docfile = {'search'},
score = {},
texdocs = {},
tlpdb = {},
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
index 3fcccf8788e..33f4dbf8881 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
@@ -150,17 +150,17 @@ end
-- set the score of a docfile
local function set_score(df, original_kw)
-- scoring is case-insensitive (patterns are already lowercased)
- local name = string.lower(df.normname)
- local df_id = string.sub(md5.sumhexa(name), 1, 7)
+ local name = df.normname:lower()
+ local df_hash = md5.sumhexa(name):sub(1, 7) -- we use normname hash for cross-platform consistency
-- special debugging function
local function dbg_score(msg, ...)
-- add the hash id prefix to make the outputs grep-friendly
- local msg = string.format('(%s) ', df_id) .. msg
+ local msg = string.format('(%s) ', df_hash) .. msg
texdoc.util.dbg_print('score', msg, ...)
end
- dbg_score('Start scoring ' .. df.realpath)
+ dbg_score('Start scoring ' .. texdoc.util.w32_path(df.realpath))
dbg_score('Name used: ' .. name)
-- get score from patterns
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu
index b560626b439..abca80786df 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu
@@ -7,6 +7,7 @@
-- dependencies
local kpse = require 'kpse'
local lfs = require 'lfs'
+local md5 = require 'md5'
local texdoc = {
const = require 'texdoclib-const',
util = require 'texdoclib-util',
@@ -75,15 +76,72 @@ function Doclist:new()
return dl
end
+-- show debug information of docfile
+local function dbg_print_docfile(df, df_hash)
+ local function make_comma_list(res, cur)
+ if res == nil then
+ return cur
+ else
+ return res .. ', ' .. cur
+ end
+ end
+
+ local function dbg_df_item(item)
+ if not df[item] then return end
+
+ local value
+ if item == 'matches' then
+ if #df[item] == 0 then return end
+
+ local cur_pattern
+ for _, v in ipairs(df[item]) do
+ -- judge alias or not
+ if v.original then
+ cur_pattern = v.name
+ else
+ cur_pattern = v.name .. ' (alias)'
+ end
+
+ value = make_comma_list(value, cur_pattern)
+ end
+ elseif item == 'sources' then
+ for _, v in ipairs(df[item]) do
+ value = make_comma_list(value, v)
+ end
+ else
+ value = df[item]
+ end
+
+ local msg = string.format('(%s) %s: %s', df_hash, item, value)
+ dbg_print('docfile', msg)
+ end
+
+ -- mandatory info
+ dbg_df_item('name')
+ dbg_df_item('tree')
+ dbg_df_item('sources')
+
+ -- support info
+ dbg_df_item('matches')
+ dbg_df_item('runtodoc')
+ dbg_df_item('tlptodoc')
+
+ -- other details
+ dbg_df_item('details')
+ dbg_df_item('lang')
+end
+
-- add a docfile to a list
function Doclist:add(df)
-- if no realpath information, unable to add
-- (useful if vanilla == false)
if not df.realpath then return end
+ local w32_path = texdoc.util.w32_path
+ local df_hash = md5.sumhexa(df.normname:lower()):sub(1, 7) -- same as debug-score
-- check the existence of the file
if not lfs.isfile(df.realpath) then
- dbg_print('search', 'File %s not found. Skipping.', df.realpath)
+ dbg_print('search', '(%d) File %s not found. Skipping.', df_hash, w32_path(df.realpath))
return
end
@@ -91,8 +149,11 @@ function Doclist:add(df)
local index = self.inv[df.realpath:lower()]
if index then
self[index]:mergein(df)
+ dbg_print('search', '(%s) Update info for %s.', df_hash, w32_path(df.realpath))
+ dbg_print_docfile(self[index], df_hash)
else
- dbg_print('search', 'File %s found.', df.realpath)
+ dbg_print('search', '(%s) File %s found.', df_hash, w32_path(df.realpath))
+ dbg_print_docfile(df, df_hash)
local newindex = #self + 1
self[newindex] = df
@@ -107,13 +168,17 @@ end
--[[
docfile = {
- -- name and tree are mandatory
+ -- mandatory fields (never be nil)
name = filename (used for scoring only)
tree = code of the tree, see below
+ matches = matched patterns: {pattern1, pattern2, ...} or {} (for sty and texdocs)
+ sources = sources of the found docfile: {source1, source2, ...} or {}
+ (where <sourceN> is either 'sty', 'tlpdb', or 'texdocs')
+
-- at least one of the following fields should exist
- matches = {pattern1, pattern2, ...} or {}
- runtodoc = true if there is a runfile -> docfile association
- tlptodoc = true if there is a tlp name -> docfile association
+ runtodoc = true if there is a runfile -> docfile association (for tlpdb)
+ tlptodoc = true if there is a tlp name -> docfile association (for tlpdb)
+
-- those are virtual members, see below
realpath = full path
normname = nomrmalised (path removed up to the 'doc' component)
@@ -122,12 +187,14 @@ docfile = {
details = details tag from the catalogue metadata
quality = 'good', 'bad', or 'killed' depending on score
ext_pos = position of the extension in ext_list
+
-- set for elements of a list as a side effect of sort_doclist()
score = score
}
-if tree > 1, this is the index of the tree in TEXDOCS
+
+if tree > 0, this is the index of the tree in TEXDOCS
if tree = 0, then name is relative to TLROOT
-tree = - 1 if and only if file is a sty file. Here name is absolute.
+tree = -1 if and only if file is a sty file. Here name is absolute.
--]]
-- Docfile objects inherit members from Docfile
@@ -160,10 +227,25 @@ end
-- merge a second docfile object in, assuming it represents the same file
function Docfile:mergein(df)
+ local function in_value(tab, val)
+ for _, v in pairs(tab) do
+ if v == val then
+ return true
+ end
+ end
+ return false
+ end
+
for k, v in pairs(df) do
if k == 'matches' then
- for _, m in ipairs(df.matches or {}) do
- table.insert(self.matches, m)
+ for _, m in ipairs(df[k] or {}) do
+ table.insert(self[k], m)
+ end
+ elseif k == 'sources' then
+ for _, s in ipairs(df[k] or {}) do
+ if not in_value(self[k], s) then
+ table.insert(self[k], s)
+ end
end
else
self[k] = v
@@ -214,11 +296,15 @@ function Docfile:get_basename()
return self.name:gsub('.*/', '')
end
--- for interface consistency, matches should always be a table, never nil
+-- for interface consistency, matches and sources should always be a table, never nil
function Docfile:get_matches()
return {}
end
+function Docfile:get_sources()
+ return {}
+end
+
-- from texdoclib-score.tlu
Docfile.get_quality = texdoc.score.docfile_quality
@@ -233,7 +319,7 @@ end
local function matches(pattern, file)
if pattern.original then
return file:lower():find(pattern.name:lower(), 1, true)
- else
+ else -- alias
return texdoc.score.is_exact(file, pattern.name)
end
end
@@ -249,11 +335,7 @@ local function process_file(patlist, file, pathfile, code)
tree = code,
pattern = pattern,
}
- if docfile then
- docfile:mergein(Docfile:new(info))
- else
- docfile = Docfile:new(info)
- end
+ docfile = Docfile:new(info)
end
end
return docfile
@@ -263,7 +345,10 @@ end
local function scan_db(patlist, code, lsr_db)
for file, basename in pairs(lsr_db) do
local df = process_file(patlist, basename, file, code)
- if df then s_doclist:add(df) end
+ if df then
+ table.insert(df.sources, 'texdocs')
+ s_doclist:add(df)
+ end
end
end
@@ -359,6 +444,7 @@ init_texdocs_database = function()
doc_roots = {}
local kpse_texdocs = kpse.expand_var('$TEXDOCS')
+ local w32_path = texdoc.util.w32_path
-- expand the path and turn it into a lua list
local raw_doc_roots = kpse.expand_braces(kpse_texdocs):explode(C.kpse_sep)
@@ -376,13 +462,13 @@ init_texdocs_database = function()
local index_mandatory = (n == 1)
dbg_print('texdocs',
'texdocs[%d] = %s (index_mandatory=%s, recursion_allowed=%s)',
- i, path, tostring(index_mandatory), tostring(recursion_allowed))
+ i, w32_path(path), tostring(index_mandatory), tostring(recursion_allowed))
-- decide if we should use a ls-R index, the filesystem, or do nothing
local root, shift = lsr_root(path)
if root and shift and recursion_allowed then
dbg_print('texdocs',
- 'texdocs[%d] using index: %s (shift=%s)', i, root, shift)
+ 'texdocs[%d] using index: %s (shift=%s)', i, w32_path(root), w32_path(shift))
db = init_lsr_db(root, shift)
elseif not index_mandatory and lfs.isdir(path) then
dbg_print('texdocs',
@@ -419,6 +505,7 @@ local function get_doclist_sty(patlist)
local df = Docfile:new({
name = file,
tree = -1,
+ sources = {'sty'},
pattern = pat,
})
s_doclist:add(df)
@@ -624,6 +711,7 @@ get_doclist_tlpdb = function(pattern)
s_doclist:add(Docfile:new{
name = file,
tree = 0,
+ sources = {'tlpdb'},
runtodoc = true,
})
end
@@ -635,6 +723,7 @@ get_doclist_tlpdb = function(pattern)
s_doclist:add(Docfile:new{
name = file,
tree = 0,
+ sources = {'tlpdb'},
tlptodoc = true,
})
end
@@ -760,7 +849,6 @@ function M.get_doclist(pattern, no_alias)
-- get results; _texdocs search comes after _tlpdb search so that
-- files found by both will have the priority of the _texdocs tree.
- -- (https://puszcza.gnu.org.ua/bugs/?369)
get_doclist_sty(sty)
get_doclist_tlpdb(pattern)
get_doclist_texdocs(normal)
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu
index 445bfaf6bc7..8d71f2957fa 100755
--- a/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu
@@ -241,6 +241,7 @@ function M.print_zsh_completion()
elseif type(opt['complete']) == 'table' then
choices = opt['complete']
end
+ table.sort(choices)
complete = '(' .. table.concat(choices, ' ') .. ')'
if opt['complete'] == 'files' then
opt['metavar'] = ' '
diff --git a/Master/texmf-dist/scripts/texdoc/texdoclib.tlu b/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
index d2c7d8996ab..83bc2403235 100644
--- a/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
+++ b/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
@@ -1,7 +1,7 @@
-- texdoclib.tlu: the texdoc library
--[[
-Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 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/Master/texmf-dist/texdoc/texdoc.cnf b/Master/texmf-dist/texdoc/texdoc.cnf
index af409250d27..d2ed087f6de 100644
--- a/Master/texmf-dist/texdoc/texdoc.cnf
+++ b/Master/texmf-dist/texdoc/texdoc.cnf
@@ -465,11 +465,19 @@ alias(0.1) fontinst = fontinstallationguide
alias hyperref-dev = hyperref.pdf
alias iso = isoman
alias knuth-pdf = knuth-pdf/index.pdf
+alias kpsewhich = kpathsea
alias kvoptions-patch = kvoptions # XXX?
alias layouts = layman
alias lettrine = lettrine # to hide context/third/lettrine-doc.pdf
alias llmk = light-latex-make/llmk
alias(2) llmk = light-latex-make/README
+alias mathfont = mathfont_user_guide
+alias mktexfmt = kpathsea
+alias mktexlsr = kpathsea
+alias mktexmf = kpathsea
+alias mktexpk = kpathsea
+alias mktextex = kpathsea
+alias mktextfm = kpathsea
alias mls = montex
alias musixtex = musixdoc
alias newtxtext = newtxdoc