summaryrefslogtreecommitdiff
path: root/biblio/bibtex/contrib/urlbst/abbrvurl.bst
diff options
context:
space:
mode:
Diffstat (limited to 'biblio/bibtex/contrib/urlbst/abbrvurl.bst')
-rw-r--r--biblio/bibtex/contrib/urlbst/abbrvurl.bst57
1 files changed, 39 insertions, 18 deletions
diff --git a/biblio/bibtex/contrib/urlbst/abbrvurl.bst b/biblio/bibtex/contrib/urlbst/abbrvurl.bst
index 6f94685378..3fe9520b54 100644
--- a/biblio/bibtex/contrib/urlbst/abbrvurl.bst
+++ b/biblio/bibtex/contrib/urlbst/abbrvurl.bst
@@ -1,7 +1,7 @@
%%% Modification of BibTeX style file /usr/local/texlive/2022/texmf-dist/bibtex/bst/base/abbrv.bst
-%%% ... by urlbst, version 0.9 (marked with "% urlbst")
+%%% ... by urlbst, version 0.9.1 (marked with "% urlbst")
%%% See <https://purl.org/nxg/dist/urlbst> and repository <https://heptapod.host/nxg/urlbst>
-%%% Modifications Copyright 2002-03, 2005-12, 2014, 2019, 2022, Norman Gray,
+%%% Modifications Copyright 2002–23, Norman Gray,
%%% and distributed under the terms of the LPPL; see README for discussion.
%%%
%%% Added webpage entry type, and url and lastchecked fields.
@@ -68,24 +68,24 @@ FUNCTION {init.urlbst.variables}
% The following constants may be adjusted by hand, if desired
% The first set allow you to enable or disable certain functionality.
- #1 'addeprints := % 0=no eprints; 1=include eprints
- #1 'adddoi := % 0=no DOI resolver; 1=include it
#2 'hrefform := % 0=no crossrefs; 1=hypertex hrefs; 2=hyperref hrefs
- #0 'doiform := % 0=with href; 1=with \doi{}
+ #1 'adddoi := % 0=no DOI resolver; 1=include it
+ #1 'addeprints := % 0=no eprints; 1=include eprints
#1 'addpubmed := % 0=no PUBMED resolver; 1=include it
#0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles
+ #0 'doiform := % 0=with href; 1=with \doi{}
% String constants, which you _might_ want to tweak.
- "[link]" 'linktextstring := % anonymous link text
- "cited " 'citedstring := % label in "lastchecked" remark
- "online" 'onlinestring := % label that a resource is online
- "doi:" 'doiprefix := % printed text to introduce DOI
- "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
- "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
"PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref
- "https://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
+ "cited " 'citedstring := % label in "lastchecked" remark
"https://doi.org/" 'doiurl := % prefix to make URL from DOI
"URL: " 'urlintro := % text prefix before URL
+ "[link]" 'linktextstring := % anonymous link text
+ "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
+ "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
+ "doi:" 'doiprefix := % printed text to introduce DOI
+ "online" 'onlinestring := % label that a resource is online
+ "https://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
% The following are internal state variables, not configuration constants,
% so they shouldn't be fiddled with.
@@ -138,6 +138,19 @@ FUNCTION {output.nonnull.original}
}
% urlbst...
+% Minimal DOI parsing.
+% Given a DOI on the stack, check whether it starts with 'doiurl' or not.
+% In either case, leave on the stack first a DOI with, and then a DOI without, the URL prefix.
+FUNCTION {parse.doi}
+{
+ #1 doiurl text.length$ substring$
+ doiurl =
+ { doi
+ doi doiurl text.length$ #1 + #999 substring$ }
+ { doiurl doi *
+ doi }
+ if$
+}
% The following three functions are for handling inlinelink. They wrap
% a block of text which is potentially output with write$ by multiple
% other functions, so we don't know the content a priori.
@@ -164,7 +177,12 @@ FUNCTION {possibly.setup.inlinelink}
if$ }
{ pubmedurl pubmed * }
if$ }
- { doiurl doi * }
+% { doiurl doi * }
+ { doi empty$
+ { "XXX" }
+ { doi parse.doi pop$ }
+ if$
+ }
if$
% an appropriately-formatted URL is now on the stack
hrefform #1 = % hypertex
@@ -761,9 +779,11 @@ FUNCTION {format.eprint}
FUNCTION {format.doi}
{ doi empty$
{ "" }
- { doiform #1 =
- { "\doi{" doi * "}" * }
- { doiprefix doi * doiurl doi * make.href }
+ { doi parse.doi % leaves "https://doi.org/DOI" DOI on the stack
+ 's := 't :=
+ doiform #1 =
+ { "\doi{" s * "}" * }
+ { doiprefix s * t make.href }
if$
}
if$
@@ -797,10 +817,11 @@ FUNCTION {output.web.refs}
inlinelinks
'skip$ % links were inline -- don't repeat them
{ % If the generated DOI will be the same as the URL,
- % then don't print the URL (thanks to Joseph Wright for this code,
+ % then don't print the URL (thanks to Joseph Wright
+ % for (the original version of) this code,
% at http://tex.stackexchange.com/questions/5660)
adddoi
- doiurl doi empty$ { "X" } { doi } if$ * % DOI URL to be generated
+ doi empty$ { "X" } { doi parse.doi pop$ } if$ % DOI URL to be generated
url empty$ { "Y" } { url } if$ % the URL, or "Y" if empty
= % are the strings equal?
and