summaryrefslogtreecommitdiff
path: root/support/ctanbib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-06-21 03:01:17 +0000
committerNorbert Preining <norbert@preining.info>2021-06-21 03:01:17 +0000
commite5ca43f7439d850f4193a932455792429cff61eb (patch)
tree35693997358e4b78d3efaeccbf948d9d68cf11ac /support/ctanbib
parent0b024adf546cd484554e4de5bd1a9919a4fdd03d (diff)
CTAN sync 202106210301
Diffstat (limited to 'support/ctanbib')
-rw-r--r--support/ctanbib/README.md2
-rwxr-xr-xsupport/ctanbib/ctanbib27
-rw-r--r--support/ctanbib/ctanbib-doc.pdfbin34681 -> 35575 bytes
-rw-r--r--support/ctanbib/ctanbib-doc.tex6
-rw-r--r--support/ctanbib/ctanbib.12
5 files changed, 27 insertions, 10 deletions
diff --git a/support/ctanbib/README.md b/support/ctanbib/README.md
index edd016e561..263cd82a1a 100644
--- a/support/ctanbib/README.md
+++ b/support/ctanbib/README.md
@@ -10,7 +10,7 @@ This script can generate BibTeX records for LaTeX packages hosted on CTAN.
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
diff --git a/support/ctanbib/ctanbib b/support/ctanbib/ctanbib
index 21adfd4679..a16976acdc 100755
--- a/support/ctanbib/ctanbib
+++ b/support/ctanbib/ctanbib
@@ -16,26 +16,38 @@ kpse.set_program_name("luatex")
-- 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 @@ version = {$version}
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 @@ end
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.title = get_title(record)
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)
diff --git a/support/ctanbib/ctanbib-doc.pdf b/support/ctanbib/ctanbib-doc.pdf
index b665ab7762..ec58084d27 100644
--- a/support/ctanbib/ctanbib-doc.pdf
+++ b/support/ctanbib/ctanbib-doc.pdf
Binary files differ
diff --git a/support/ctanbib/ctanbib-doc.tex b/support/ctanbib/ctanbib-doc.tex
index 651d0058e6..89b99279b5 100644
--- a/support/ctanbib/ctanbib-doc.tex
+++ b/support/ctanbib/ctanbib-doc.tex
@@ -36,6 +36,7 @@ The \texttt{curl} utility needs to be installed on the user's system in order to
\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 @@ under the terms of the \LaTeX\ Project Public License, version 1.3.
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}
diff --git a/support/ctanbib/ctanbib.1 b/support/ctanbib/ctanbib.1
index baa40b1190..54544054c8 100644
--- a/support/ctanbib/ctanbib.1
+++ b/support/ctanbib/ctanbib.1
@@ -13,6 +13,8 @@ CTAN in the BibTeX format.
.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