From f18baaf545c73262376befaccac7fda005b26975 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 30 Jun 2021 21:19:31 +0000 Subject: ctanbib (30jun21) git-svn-id: svn://tug.org/texlive/trunk@59782 c570f23f-e606-0410-a88d-b1316a301751 --- .../texk/texlive/linked_scripts/ctanbib/ctanbib | 13 ++++++++++++- Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf | Bin 21346 -> 21346 bytes .../texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf | Bin 35307 -> 35854 bytes .../texmf-dist/doc/support/ctanbib/ctanbib-doc.tex | 21 +++++++++++++++++++++ Master/texmf-dist/scripts/ctanbib/ctanbib | 13 ++++++++++++- 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib b/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib index f54e1691ca2..70b31badbac 100755 --- a/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib +++ b/Build/source/texk/texlive/linked_scripts/ctanbib/ctanbib @@ -24,6 +24,7 @@ Usage: ctanbib [options] name1 name2 ... Available options: -c,--ctan Use CTAN URL instead of the package homepage + -C,--ctanpath Use package's CTAN path as URL -e,--entrytype (default manual) Change entry type -h,--help Print this message -v,--version Print version info @@ -33,7 +34,7 @@ if args.help then print(msg) os.exit(0) elseif args.version then - print "ctanbib version 0.2" + print "ctanbib version 0.2a" os.exit(0) elseif args.ctan then pkgurl = true @@ -186,6 +187,14 @@ local ctan_url = function(record, pkgname) return "https://ctan.org/pkg/"..pkgname end +local ctan_path = function(record) + local ctan = record:query_selector("ctan")[1] + -- some package don't contain the CTAN path + if not ctan then return get_url(record) end + local path = ctan:get_attribute("path") + return path +end + local compile = function(template, records) return template:gsub("$([a-z]+)", function(a) @@ -215,6 +224,8 @@ for _, pkgname in ipairs(args) do -- use the CTAN path as url for the CTAN type if pkgurl then e.url = ctan_url(record, pkgname) + elseif args.ctanpath then + e.url = ctan_path(record) end e.version, e.date = get_version(record) e.urldate = os.date("%Y-%m-%d") diff --git a/Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf b/Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf index 5d4342c0ca1..2c753a32a20 100644 Binary files a/Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf and b/Master/texmf-dist/doc/man/man1/ctanbib.man1.pdf differ diff --git a/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf b/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf index 1fb514277c7..87296fca78e 100644 Binary files a/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf and b/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.pdf differ diff --git a/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex b/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex index c9d2a96abeb..fb718635abd 100644 --- a/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex +++ b/Master/texmf-dist/doc/support/ctanbib/ctanbib-doc.tex @@ -38,6 +38,7 @@ The \texttt{curl} utility needs to be installed on the user's system in order to \begin{description} \item[-c,-\/-ctan] use the CTAN package entry as package URL instead of URL provided by the package. + \item[-C,-\/-ctanpath] use package's CTAN path as URL \item[-e,-\/-entrypoint] explicitly set the Bib\TeX\ entry type. \item[-h,-\/-help] print the help message. \item[-v,-\/-version] print the version info. @@ -84,6 +85,24 @@ url = {https://ctan.org/pkg/latex}, } \end{verbatim} +\noindent The \texttt{--ctanpath} option: + +\begin{verbatim} +ctanbib -C biblatex +\end{verbatim} + +\noindent This produces a bib record that uses the CTAN package tree location for the URL. + +\begin{verbatim} +@manual{biblatex, +... +url = {/macros/latex/contrib/biblatex}, +... +} +\end{verbatim} + + + \noindent The \texttt{--entrytype} option: \begin{verbatim} @@ -115,6 +134,8 @@ it's eventual release on CTAN. Herbert Voss added the \verb|--CTAN| option. \section{Changelog} \begin{changelog} + \change{2021-06-29}{Version 0.2a released} + \change{2021-06-29}{Added the \verb|--ctanpath| option.} \change{2021-06-26}{Version 0.2 released} \change{2021-06-26}{Removed the \verb|--CTAN| option, entry type can be set using \verb|--entrytype| and CTAN URL is requested using \verb|--ctan|} \change{2021-06-26}{Added \verb|--entrytype| option for explicit specification of the Bib\TeX\ entry type} diff --git a/Master/texmf-dist/scripts/ctanbib/ctanbib b/Master/texmf-dist/scripts/ctanbib/ctanbib index f54e1691ca2..70b31badbac 100755 --- a/Master/texmf-dist/scripts/ctanbib/ctanbib +++ b/Master/texmf-dist/scripts/ctanbib/ctanbib @@ -24,6 +24,7 @@ Usage: ctanbib [options] name1 name2 ... Available options: -c,--ctan Use CTAN URL instead of the package homepage + -C,--ctanpath Use package's CTAN path as URL -e,--entrytype (default manual) Change entry type -h,--help Print this message -v,--version Print version info @@ -33,7 +34,7 @@ if args.help then print(msg) os.exit(0) elseif args.version then - print "ctanbib version 0.2" + print "ctanbib version 0.2a" os.exit(0) elseif args.ctan then pkgurl = true @@ -186,6 +187,14 @@ local ctan_url = function(record, pkgname) return "https://ctan.org/pkg/"..pkgname end +local ctan_path = function(record) + local ctan = record:query_selector("ctan")[1] + -- some package don't contain the CTAN path + if not ctan then return get_url(record) end + local path = ctan:get_attribute("path") + return path +end + local compile = function(template, records) return template:gsub("$([a-z]+)", function(a) @@ -215,6 +224,8 @@ for _, pkgname in ipairs(args) do -- use the CTAN path as url for the CTAN type if pkgurl then e.url = ctan_url(record, pkgname) + elseif args.ctanpath then + e.url = ctan_path(record) end e.version, e.date = get_version(record) e.urldate = os.date("%Y-%m-%d") -- cgit v1.2.3