summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/ctanbib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-06-30 21:19:31 +0000
committerKarl Berry <karl@freefriends.org>2021-06-30 21:19:31 +0000
commitf18baaf545c73262376befaccac7fda005b26975 (patch)
treeb0c9e76683ce84f9e93db78a971b9d560e3a84bb /Master/texmf-dist/scripts/ctanbib
parent3cd1d85cb7521f6e36b5797788adae39e07b5635 (diff)
ctanbib (30jun21)
git-svn-id: svn://tug.org/texlive/trunk@59782 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/ctanbib')
-rwxr-xr-xMaster/texmf-dist/scripts/ctanbib/ctanbib13
1 files changed, 12 insertions, 1 deletions
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")