texlive[70559] Master/texmf-dist: texdoc (10mar24)

commits+karl at tug.org commits+karl at tug.org
Sun Mar 10 21:06:52 CET 2024


Revision: 70559
          https://tug.org/svn/texlive?view=revision&revision=70559
Author:   karl
Date:     2024-03-10 21:06:52 +0100 (Sun, 10 Mar 2024)
Log Message:
-----------
texdoc (10mar24)

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/README.md
    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-config.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-view.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib.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-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/doc/man/man1/texdoc.1	2024-03-10 20:06:52 UTC (rev 70559)
@@ -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

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-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/doc/support/texdoc/NEWS	2024-03-10 20:06:52 UTC (rev 70559)
@@ -2,6 +2,13 @@
 ===============
 (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

Modified: trunk/Master/texmf-dist/doc/support/texdoc/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/README.md	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/doc/support/texdoc/README.md	2024-03-10 20:06:52 UTC (rev 70559)
@@ -104,7 +104,7 @@
 
 ## 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.
 

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-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex	2024-03-10 20:06:52 UTC (rev 70559)
@@ -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 @@
 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}

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu	2024-03-10 20:06:52 UTC (rev 70559)
@@ -592,7 +592,7 @@
         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',
     }

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2024-03-10 20:06:52 UTC (rev 70559)
@@ -22,8 +22,8 @@
 -- 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

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2024-03-10 20:06:52 UTC (rev 70559)
@@ -213,8 +213,15 @@
     -- 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 @@
             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

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-view.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-view.tlu	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-view.tlu	2024-03-10 20:06:52 UTC (rev 70559)
@@ -161,76 +161,101 @@
 
 -----------------------------   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')
 
-        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
-            end
-        end
+    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
-    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)
+    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
+
+            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
 
-    if not last_i then
+    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 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 @@
         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 @@
         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

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu	2024-03-10 20:06:52 UTC (rev 70559)
@@ -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

Modified: trunk/Master/texmf-dist/texdoc/texdoc.cnf
===================================================================
--- trunk/Master/texmf-dist/texdoc/texdoc.cnf	2024-03-10 20:06:38 UTC (rev 70558)
+++ trunk/Master/texmf-dist/texdoc/texdoc.cnf	2024-03-10 20:06:52 UTC (rev 70559)
@@ -330,6 +330,7 @@
 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 @@
 
 # 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



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