texlive[59659] trunk: ctanbib (20jun21)

commits+karl at tug.org commits+karl at tug.org
Sun Jun 20 21:57:54 CEST 2021


Revision: 59659
          http://tug.org/svn/texlive?view=revision&revision=59659
Author:   karl
Date:     2021-06-20 21:57:54 +0200 (Sun, 20 Jun 2021)
Log Message:
-----------
ctanbib (20jun21)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib
    trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
    trunk/Master/texmf-dist/doc/man/man1/ctanbib.1
    trunk/Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf
    trunk/Master/texmf-dist/doc/support/ctanbib/README.md
    trunk/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf
    trunk/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex
    trunk/Master/texmf-dist/scripts/ctanbib/ctanbib

Modified: trunk/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib	2021-06-20 19:57:54 UTC (rev 59659)
@@ -16,26 +16,38 @@
 -- The Current Maintainer of this work is Michal Hoftich
 
 local bibtype = "manual"
+local pkgurl = false
 if #arg < 1 or arg[1]=="--help" or arg[1]=="-h" then
   print([[ctanbib - convert ctan package information to bibtex format
 Usage:
 ctanbib [options] <package name>
 Available options:
-  -c,--ctan       Use @ctan type instead of @manual
+  -c,--ctan       Use @ctan type instead of @manual and long url
+  -C,--CTAN       Use @ctan type and short ... /pkg/url
   -h,--help       Print this message
   -v,--version    Print version info
   ]])
-  os.exit(1)
+  os.exit(0)
 elseif arg[1]=="--version" or arg[1]=="-v" then
-  print "ctanbib version 0.1d"
-  os.exit(1)
+  print "ctanbib version 0.1e"
+  os.exit(0)
 elseif arg[1]=="--ctan" or arg[1]=="-c" then
   table.remove(arg, 1)
   bibtype = "ctan"
+elseif arg[1]=="--CTAN" or arg[1]=="-C" then
+  table.remove(arg, 1)
+  bibtype = "ctan"
+  pkgurl = true
 end
 
 local pkgname = arg[1]
-local url = "https://www.ctan.org/xml/2.0/pkg/" .. pkgname .. "?author-name=true"
+
+if not pkgname then 
+  print "[ctanbib] Error: missing package name"
+  os.exit(1)
+end
+
+local url = "https://ctan.org/xml/2.0/pkg/" .. pkgname .. "?author-name=true"
 local authors_url = "https://ctan.org/xml/2.0/authors"
 
 -- change that for different title scheme
@@ -55,7 +67,6 @@
 
 local dom = require('luaxml-domobject')
 
-
 local load_xml =  function(url)
   -- local command = io.popen("wget -qO- ".. url,"r")
   local command = io.popen("curl -sS ".. url,"r")
@@ -142,7 +153,7 @@
 local get_url = function(record)
   local home = record:query_selector("home")[1]
   if home then return home:get_attribute("href") end
-  return "http://www.ctan.org/pkg/"..pkgname
+  return "https://ctan.org/pkg/"..pkgname
 end
 
 local get_caption = function(record)
@@ -191,7 +202,7 @@
 e.subtitle = get_caption(record)
 e.url = get_url(record)
 -- use the CTAN path as url for the CTAN type
-if bibtype == "ctan" then
+if (bibtype == "ctan") and not pkgurl then
   e.url = ctan_url(record)
 end
 e.version, e.date = get_version(record)

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2021-06-20 19:57:54 UTC (rev 59659)
@@ -1,12 +1,12 @@
 #!/usr/bin/env perl
-# $Id: tlmgr.pl 59568 2021-06-12 22:02:32Z karl $
+# $Id: tlmgr.pl 59637 2021-06-19 15:17:38Z karl $
 #
 # Copyright 2008-2021 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 
-my $svnrev = '$Revision: 59568 $';
-my $datrev = '$Date: 2021-06-13 00:02:32 +0200 (Sun, 13 Jun 2021) $';
+my $svnrev = '$Revision: 59637 $';
+my $datrev = '$Date: 2021-06-19 17:17:38 +0200 (Sat, 19 Jun 2021) $';
 my $tlmgrrevision;
 my $tlmgrversion;
 my $prg;
@@ -2574,7 +2574,8 @@
     next if $removals_full{$p};
     my $remotetlp = $remotetlpdb->get_package($p);
     if (!defined($remotetlp)) {
-      tlwarn("$prg: Strange, $p mentioned but not found anywhere!\n");
+      tlwarn("$prg:auto_remove_install_force_packages: strange, package "
+             . "mentioned but not found anywhere: $p\n");
       next;
     }
     next if ($remotetlp->category ne "Collection");
@@ -4109,7 +4110,8 @@
       if (@cand) {
         my $first = shift @cand;
         if (defined($first)) {
-          tlwarn("$prg: strange, we have a first candidate but no tlp: $p\n");
+          tlwarn("$prg:show_one_package_list: strange, have first "
+                 . "candidate but no tlp: $p\n");
           return($F_WARNING);
         }
         # already shifted away the first element
@@ -4122,19 +4124,23 @@
             my ($t,$r) = split(/\//, $a, 2);
             my $tlp = $remotetlpdb->get_package($p, $t);
             my $foo = $tlp->shortdesc;
-            print "      $t: ", defined($foo) ? $foo : "(shortdesc missing)" , "\n";
+            print "      $t: ",
+                  defined($foo) ? $foo : "(shortdesc missing)" , "\n";
           }
           return($F_WARNING);
         } else {
-          tlwarn("$prg: strange, package listed but no residual candidates: $p\n");
+          tlwarn("$prg:show_one_package_list: strange, package listed "
+                 . "but no residual candidates: $p\n");
           return($F_WARNING);
         }
       } else {
-        tlwarn("$prg: strange, package listed but no candidates: $p\n");
+        tlwarn("$prg:show_one_package_list: strange, package listed but "
+               . "no candidates: $p\n");
         return($F_WARNING);
       }
     } else {
-      tlwarn("$prg: strange, package cannot be found in remote tlpdb: $p\n");
+      tlwarn("$prg:show_one_package_list: strange, package not found in "
+             . "remote tlpdb: $p\n");
       return($F_WARNING);
     }
   }
@@ -4189,7 +4195,8 @@
         # useless test, @cand will always be defined because $remotetlpdb is virtual
         my $first = shift @cand;
         if (defined($first)) {
-          tlwarn("$prg: strange, we have a first candidate but no tlp: $pkg\n");
+          tlwarn("$prg:show_one_package_detail: strange, have first candidate "
+                 . "but no tlp: $pkg\n");
           return($F_WARNING);
         }
         # already shifted away the first element
@@ -10224,7 +10231,7 @@
 distribution (L<https://tug.org/texlive>) and both are licensed under the
 GNU General Public License Version 2 or later.
 
-$Id: tlmgr.pl 59568 2021-06-12 22:02:32Z karl $
+$Id: tlmgr.pl 59637 2021-06-19 15:17:38Z karl $
 =cut
 
 # test HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html

Modified: trunk/Master/texmf-dist/doc/man/man1/ctanbib.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/ctanbib.1	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Master/texmf-dist/doc/man/man1/ctanbib.1	2021-06-20 19:57:54 UTC (rev 59659)
@@ -13,6 +13,8 @@
 .IP -c,--ctan 
 use @ctan type instead of @manual. The difference between the two is that the
 url field contains package CTAN path, instead of link to the package.
+.IP -C,--CTAN 
+like --ctan option, but use original url instead of CTAN path.
 .IP -h,--help 
 print the help message.
 .IP -v,--version 

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

Modified: trunk/Master/texmf-dist/doc/support/ctanbib/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/ctanbib/README.md	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Master/texmf-dist/doc/support/ctanbib/README.md	2021-06-20 19:57:54 UTC (rev 59659)
@@ -10,7 +10,7 @@
 More details can be found on [TeX.sx](https://tex.stackexchange.com/a/200856/2891)
 
 
-Copyright: 2018 Michal Hoftich
+Copyright: 2019 Michal Hoftich
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3

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

Modified: trunk/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex	2021-06-20 19:57:54 UTC (rev 59659)
@@ -36,6 +36,7 @@
   \item[-c,-\/-ctan] use the \texttt{@ctan} type instead of \texttt{@manual}.
     The difference between the two is that the url field contains packages CTAN
     path, instead of a link to the package.
+  \item[-C,-\/-CTAN] like \verb|--ctan| option, but use original url instead of CTAN path.
   \item[-h,-\/-help] print the help message.
   \item[-v,-\/-version] print the version info.
 \end{description}
@@ -93,12 +94,15 @@
 This package was created thanks to TeX.sx user
 Daniel\footnote{\url{https://tex.stackexchange.com/users/3751/daniel}}. Lukas
 C.~Bossert had useful comments which led to update of the original script and
-it's eventual release on CTAN.
+it's eventual release on CTAN. Herbert Voss added the \verb|--CTAN| option.
 
 \newpage
 \section{Changelog}
 
 \begin{changelog}
+  \change{2021-06-20}{Added \verb|--CTAN| option, thanks to Herbert Voss}
+  \change{2019-12-23}{Don't return non-zero exit codes for non-error runs}
+  \change{2019-12-23}{Test for the packagename with the \texttt{-c} option}
   \change{2019-09-21}{Try to find the author in full CTAN author list if the author cannot be found in the package info}
   \change{2019-09-16}{Use the CTAN API 2.0 to fetch the package info}
   \change{2019-05-04}{Version 0.1c released}

Modified: trunk/Master/texmf-dist/scripts/ctanbib/ctanbib
===================================================================
--- trunk/Master/texmf-dist/scripts/ctanbib/ctanbib	2021-06-20 19:57:32 UTC (rev 59658)
+++ trunk/Master/texmf-dist/scripts/ctanbib/ctanbib	2021-06-20 19:57:54 UTC (rev 59659)
@@ -16,26 +16,38 @@
 -- The Current Maintainer of this work is Michal Hoftich
 
 local bibtype = "manual"
+local pkgurl = false
 if #arg < 1 or arg[1]=="--help" or arg[1]=="-h" then
   print([[ctanbib - convert ctan package information to bibtex format
 Usage:
 ctanbib [options] <package name>
 Available options:
-  -c,--ctan       Use @ctan type instead of @manual
+  -c,--ctan       Use @ctan type instead of @manual and long url
+  -C,--CTAN       Use @ctan type and short ... /pkg/url
   -h,--help       Print this message
   -v,--version    Print version info
   ]])
-  os.exit(1)
+  os.exit(0)
 elseif arg[1]=="--version" or arg[1]=="-v" then
-  print "ctanbib version 0.1d"
-  os.exit(1)
+  print "ctanbib version 0.1e"
+  os.exit(0)
 elseif arg[1]=="--ctan" or arg[1]=="-c" then
   table.remove(arg, 1)
   bibtype = "ctan"
+elseif arg[1]=="--CTAN" or arg[1]=="-C" then
+  table.remove(arg, 1)
+  bibtype = "ctan"
+  pkgurl = true
 end
 
 local pkgname = arg[1]
-local url = "https://www.ctan.org/xml/2.0/pkg/" .. pkgname .. "?author-name=true"
+
+if not pkgname then 
+  print "[ctanbib] Error: missing package name"
+  os.exit(1)
+end
+
+local url = "https://ctan.org/xml/2.0/pkg/" .. pkgname .. "?author-name=true"
 local authors_url = "https://ctan.org/xml/2.0/authors"
 
 -- change that for different title scheme
@@ -55,7 +67,6 @@
 
 local dom = require('luaxml-domobject')
 
-
 local load_xml =  function(url)
   -- local command = io.popen("wget -qO- ".. url,"r")
   local command = io.popen("curl -sS ".. url,"r")
@@ -142,7 +153,7 @@
 local get_url = function(record)
   local home = record:query_selector("home")[1]
   if home then return home:get_attribute("href") end
-  return "http://www.ctan.org/pkg/"..pkgname
+  return "https://ctan.org/pkg/"..pkgname
 end
 
 local get_caption = function(record)
@@ -191,7 +202,7 @@
 e.subtitle = get_caption(record)
 e.url = get_url(record)
 -- use the CTAN path as url for the CTAN type
-if bibtype == "ctan" then
+if (bibtype == "ctan") and not pkgurl then
   e.url = ctan_url(record)
 end
 e.version, e.date = get_version(record)



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