texlive[69672] Master/texmf-dist: texdoc (2feb24)

commits+karl at tug.org commits+karl at tug.org
Fri Feb 2 22:40:16 CET 2024


Revision: 69672
          https://tug.org/svn/texlive?view=revision&revision=69672
Author:   karl
Date:     2024-02-02 22:40:15 +0100 (Fri, 02 Feb 2024)
Log Message:
-----------
texdoc (2feb24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/man/man1/texdoc.1
    trunk/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
    trunk/Master/texmf-dist/doc/support/texdoc/NEWS
    trunk/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
    trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
    trunk/Master/texmf-dist/texdoc/texdoc.cnf

Modified: trunk/Master/texmf-dist/doc/man/man1/texdoc.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/texdoc.1	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/doc/man/man1/texdoc.1	2024-02-02 21:40:15 UTC (rev 69672)
@@ -1,7 +1,7 @@
 .\" generated with Ronn/v0.7.3
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
-.TH "TEXDOC" "1" "February 2023" "Texdoc 4.0.1" "Texdoc manual"
+.TH "TEXDOC" "1" "February 2024" "Texdoc 4.0.2" "Texdoc manual"
 .
 .SH "NAME"
 \fBtexdoc\fR \- find & view documentation in TeX Live
@@ -160,7 +160,7 @@
 Source: \fIhttps://github\.com/TeX\-Live/texdoc\fR
 .
 .SH "COPYRIGHT"
-Copyright 2008\-2023 Manuel Pe\'gourie\'\-Gonnard, Takuto Asakura, the TeX Live Team\.
+Copyright 2008\-2024 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\.

Modified: trunk/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/texdoc/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/NEWS	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/doc/support/texdoc/NEWS	2024-02-02 21:40:15 UTC (rev 69672)
@@ -2,6 +2,12 @@
 ===============
 (This file public domain.)
 
+Version 4.0.2 (2024-02-02)
+--------------------------
+- Improve the option parser
+- Better locale handling
+- Scoring adjustments
+
 Version 4.0.1 (2023-02-27)
 --------------------------
 - Minor bug fixes for Windows
@@ -13,9 +19,9 @@
 Release for TeX Live 2023.
 
 Major changes
-- Online search feature is added (by Wu Zhenyu):
+- Online search feature is added (by Max Chernoff):
   users using TL without documentation will be sent to texdoc.org
-- Add new action --print-completion (by Max Chernoff):
+- Add new action --print-completion (by Wu Zhenyu):
   for the moment, only zsh is supported. Contributions welcome.
 
 Minor fixes and tweaks

Modified: trunk/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex	2024-02-02 21:40:15 UTC (rev 69672)
@@ -1,6 +1,6 @@
 %#!texfot xelatex
 % Texdoc user manual
-% Copyright 2008-2023 Manuel Pégourié-Gonnard and Takuto Asakura
+% Copyright 2008-2024 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.0.1\quad \today}
+\date{v4.0.2\quad \today}
 
 \begin{document}
 
@@ -787,13 +787,8 @@
 \item adding \code{eval "\$(texdoc \lopt{print-completion} zsh)"} to your
   zsh configuration file.
 
-\item adding a file somewhere in \code{\$fpath} with the following contents:
-%
-\begin{htcode}
-#compdef texdoc
-(( $+functions[__texdoc] )) || eval "$(texdoc \textbackslash
-  --print-completion zsh)" && __texdoc
-\end{htcode}
+\item creating a file named \code{\_texdoc} in \code{\$fpath} whose content is
+  the output of \code{texdoc \lopt{print-completion} zsh}.
 \end{itemize}
 
 \section{Licence}
@@ -800,7 +795,7 @@
 \label{sec:licence}
 
 The current version of Texdoc program and its documentation are copyright
-2008--2023 Manuel Pégourié-Gonnard, Takuto Asakura, the {\TL} Team.
+2008--2024 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

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu	2024-02-02 21:40:15 UTC (rev 69672)
@@ -21,32 +21,36 @@
 -- modified Alternative GetOpt
 -- cf. http://lua-users.org/wiki/AlternativeGetOpt
 local function getopt(arg, options)
-    local tmp = nil
+    local tmp
     local tab = {}
     local saved_arg = {table.unpack(arg)}
 
     for k, v in ipairs(saved_arg) do
-        if string.sub(v, 1, 2) == '--' then
+        if v:sub(1, 2) == '--' then
             table.remove(arg, 1)
-            local x = string.find(v, '=', 1, true)
+            if v == '--' then -- terminate parsing
+                break
+            end
+
+            local x = v:find('=', 1, true)
             if x then
-                table.insert(tab, {string.sub(v, 3, x - 1), string.sub(v, x+1)})
+                table.insert(tab, {v:sub(3, x - 1), v:sub(x+1)})
             else
-                table.insert(tab, {string.sub(v, 3), true})
+                table.insert(tab, {v:sub(3), true})
             end
 
-        elseif string.sub(v, 1, 1) == '-' then
+        elseif v:sub(1, 1) == '-' then
             table.remove(arg, 1)
             local y = 2
-            local l = string.len(v)
+            local l = v:len()
             local jopt
 
             while (y <= l) do
-                jopt = string.sub(v, y, y)
+                jopt = v:sub(y, y)
 
-                if string.find(options, jopt, 1, true) then
+                if options:find(jopt, 1, true) then
                     if y < l then
-                        tmp = string.sub(v, y + 1)
+                        tmp = v:sub(y + 1)
                         y = l
                     else
                         table.remove(arg, 1)
@@ -60,7 +64,7 @@
                         os.exit(C.exit_error)
                     end
 
-                    if string.match(tmp, '^%-') then
+                    if tmp:match('^%-') then
                         table.insert(tab, {jopt, false})
                     else
                         table.insert(tab, {jopt, tmp})
@@ -102,7 +106,7 @@
         end
 
         for i, o in ipairs(C.options) do
-            if k == o["short"] or k == o["long"] then
+            if k == o['short'] or k == o['long'] then
                 k = i
                 break
             end
@@ -109,7 +113,7 @@
         end
 
         option = C.options[k]
-        if option['group'] == 'action' then
+        if option ~= nil and option['group'] == 'action' then
             if option['long'] == 'just-view' then
                 return true, 'view', cl_config
             elseif option['long'] == 'print-completion' then
@@ -117,7 +121,7 @@
             else
                 return true, option['long'], cl_config
             end
-        elseif 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

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2024-02-02 21:40:15 UTC (rev 69672)
@@ -22,8 +22,8 @@
 -- progname and version
 fullname = kpse.find_file('texdoc/texdoclib', 'lua')
 progname = 'Texdoc'
-version = '4.0.1'
-release_date = '2023-02-27'
+version = '4.0.2'
+release_date = '2024-02-02'
 
 -- make sure to update setup_config_from_cl() accordingly
 -- and set a default value in setup_config_from_defaults() if relevant
@@ -50,8 +50,8 @@
 Repository: <https://github.com/TeX-Live/texdoc>
 Please email bugs to <texdoc at tug.org>.]]
 
-zsh_completion = [[
-compdef __texdoc texdoc
+zsh_completion = [=[
+#compdef texdoc
 
 __texdoc() {
   local options=(
@@ -72,8 +72,16 @@
     ;;
   esac
 }
-]]
 
+if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
+  # autoload from fpath, call function directly
+  __texdoc "$@"
+else
+  # eval/source/. command, register function for later
+  compdef __texdoc texdoc
+fi
+]=]
+
 --[[ structure of the options table
 
 options = {
@@ -260,7 +268,7 @@
 }
 
 copyright_msg = [[
-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.
 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.]]
 

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2024-02-02 21:40:15 UTC (rev 69672)
@@ -212,7 +212,7 @@
 
     -- bonus for locale
     local config_lang = texdoc.config.get_value('lang')
-    if not is_alias and config_lang ~= nil then
+    if not is_alias then
         local file_lang = df.lang
 
         if not file_lang then
@@ -220,10 +220,12 @@
             file_lang = texdoc.const.lang_codes[file_lang]
         end
 
-        if config_lang == file_lang then
+        if config_lang ~= nil and config_lang == file_lang then
             score = score + 1
             dbg_score('Locale match bonus: +1.0')
-        elseif file_lang ~= nil then
+        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)
             score = score - 0.1
             dbg_score('Locale unmatch: -0.1')
         end
@@ -308,19 +310,18 @@
 
 -- returns the index of the most specific extension of file in ext_list,
 -- or config.ext_list_max + 1
-function M.ext_pos(file)
+function M.ext_pos(filename)
     -- remove zipext if applicable
-    file = texdoc.util.parse_zip(file)
+    filename = texdoc.util.parse_zip(filename)
     -- now find the extension
     local p, e, pos, ext
     for p, e in ipairs(texdoc.config.get_value('ext_list')) do
         if (e == '*') and (ext == nil) then
             pos, ext = p, e
-        elseif (e == '') and not string.find(file, '.', 1, true) then
+        elseif (e == '') and not filename:find('.', 1, true) then
             pos, ext = p, e
-        elseif string.sub(file, -string.len(e)-1) == '.' .. e then
-            if (ext == nil) or (ext == '*')
-                or (string.len(e) > string.len(ext)) then
+        elseif filename:sub(-e:len() - 1) == '.' .. e then
+            if (ext == nil) or (ext == '*') or (e:len() > ext:len()) then
                 pos, ext = p, e
             end
         end

Modified: trunk/Master/texmf-dist/texdoc/texdoc.cnf
===================================================================
--- trunk/Master/texmf-dist/texdoc/texdoc.cnf	2024-02-02 14:08:05 UTC (rev 69671)
+++ trunk/Master/texmf-dist/texdoc/texdoc.cnf	2024-02-02 21:40:15 UTC (rev 69672)
@@ -200,10 +200,9 @@
 adjscore(context) context.man1 = +2
 adjscore(symbols) /staves/ = -5
 
-# catalogue info missing in the tlcontrib version of the package :-(
+# catalogue info missing cases
+adjscore(inputenc) inputenc.pdf = +5
 adjscore(pgf) pgfmanual.pdf = +5
-
-# another catalogue info missing case
 adjscore(hyph-utf8) hyphenation.pdf = +5
 
 # let's not have context version found first
@@ -330,6 +329,7 @@
 alias fontenc = source2e
 alias textcomp = source2e
 alias tracefnt = source2e
+alias structuredlog = ltfilehook-doc
 # TODO: try to avoid the huge amount of false positives for `doc' itself.
 
 # latex-dev instruction
@@ -501,6 +501,9 @@
 alias ofs-cz = ofsdoc
 alias ofs = ofsdoc-e
 
+# a rare case: '-p.pdf' (for printing, a4), '-s.pdf' (for screen)
+alias metafun = metafun-p
+
 ## aliases basically borrowed from texdoctk.dat with some adaptations
 alias akletter = akletter/lettereng
 alias arydshln = arydshln-man



More information about the tex-live-commits mailing list.