diff options
Diffstat (limited to 'Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst | 303 |
1 files changed, 237 insertions, 66 deletions
diff --git a/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst b/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst index d18332871bd..19ed512e504 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/alpha.bst -%%% to add webpage entry type, and url and lastchecked fields -%%% Edits by urlbst.pl, version 0.1 -%%% (marked with % urlbst.pl) +%%% Modification of BibTeX style file /usr/local/texlive/2007/texmf-dist/bibtex/bst/base/alpha.bst +%%% ... by urlbst, version 0.6-1 (marked with "% urlbst") +%%% See <http://purl.org/nxg/dist/urlbst> +%%% Added webpage entry type, and url and lastchecked fields. +%%% Added eprint support. +%%% Added DOI support. +%%% Added PUBMED support. +%%% Added hyperref support. %%% Original headers follow... + % BibTeX standard bibliography style `alpha' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -36,22 +41,54 @@ ENTRY type volume year - url % urlbst.pl - lastchecked + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label extra.label sort.label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } -INTEGERS { bracket.state outside.brackets open.brackets within.brackets close.brackets } % urlbst.pl +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver } +% Following constants may be adjusted by hand, if desired +FUNCTION {init.urlbst.variables} +{ + "Available from: " 'urlintro := % prefix before URL + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref + "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "doi:" 'doiprefix := % text prefix printed before DOI ref + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref + #1 'addeprints := % 0=no eprints; 1=include eprints + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it + #2 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'outside.brackets := % urlbst.pl +{ #0 'outside.brackets := % urlbst #1 'open.brackets := #2 'within.brackets := #3 'close.brackets := - #0 'before.all := + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := @@ -59,7 +96,7 @@ FUNCTION {init.state.consts} STRINGS { s t } -% urlbst.pl +% urlbst FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = @@ -81,12 +118,50 @@ FUNCTION {output.nonnull.original} s } -% urlbst.pl... +% urlbst... +% 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. +% They communicate between each other using the variables makeinlinelink +% (which is true if a link should be made), and closeinlinelink (which holds +% the string which should close any current link. They can be called +% at any time, but start.inlinelink will be a no-op unless something has +% previously set makeinlinelink true, and the two ...end.inlinelink functions +% will only do their stuff if start.inlinelink has previously set +% closeinlinelink to be non-empty. +FUNCTION {setup.inlinelink} +{ makeinlinelink + { hrefform #1 = % hypertex + { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink := + "\special {html:</a>}" 'closeinlinelink := + } + { hrefform #2 = % hyperref + { "\href{" url * "}{" * 'openinlinelink := + "}" 'closeinlinelink := + } + 'skip$ + if$ % hrefform #2 = + } + if$ % hrefform #1 = + #0 'makeinlinelink := + } + 'skip$ + if$ % makeinlinelink +} +FUNCTION {add.inlinelink} +{ openinlinelink empty$ + 'skip$ + { openinlinelink swap$ * closeinlinelink * + "" 'openinlinelink := + } + if$ +} FUNCTION {output.nonnull} { % Save the thing we've been asked to output 's := - % If the bracket-state is close.brackets, then add a close-bracket to what's - % currently at the top of the stack, and set bracket.state to outside.brackets + % If the bracket-state is close.brackets, then add a close-bracket to + % what is currently at the top of the stack, and set bracket.state + % to outside.brackets bracket.state close.brackets = { "]" * outside.brackets 'bracket.state := @@ -98,7 +173,8 @@ FUNCTION {output.nonnull} % Write out what's currently at the top of the stack, using the % original output.nonnull function. s - output.nonnull.original + add.inlinelink + output.nonnull.original % invoke the original output.nonnull } { % Still in brackets. Add open-bracket or (continuation) comma, add the % new text (in s) to the top of the stack, and move to the close-brackets @@ -123,20 +199,13 @@ FUNCTION {inbrackets} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { "Available from World Wide Web: \url{" url * "}" * } - if$ -} - FUNCTION {format.lastchecked} { lastchecked empty$ { "" } { inbrackets "cited " lastchecked * } if$ } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {output} { duplicate$ empty$ @@ -153,9 +222,8 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} -{ outside.brackets 'bracket.state := % urlbst.pl - newline$ +FUNCTION {output.bibitem.original} +{ newline$ "\bibitem[" write$ label write$ "]{" write$ @@ -166,13 +234,8 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {fin.entry} -{ - bracket.state close.brackets = % urlbst.pl - { "]" * } - 'skip$ - if$ - add.period$ +FUNCTION {fin.entry.original} +{ add.period$ write$ newline$ } @@ -614,7 +677,73 @@ FUNCTION {format.incoll.inproc.crossref} " \cite{" * crossref * "}" * } -% urlbst.pl... +% urlbst... +% Functions for making hypertext links. +% In all cases, the stack has (link-text href-url) +% +% make 'null' specials +FUNCTION {make.href.null} +{ + pop$ +} +% make hypertex specials +FUNCTION {make.href.hypertex} +{ + "\special {html:<a href=" quote$ * + swap$ * quote$ * "> }" * swap$ * + "\special {html:</a>}" * +} +% make hyperref specials +FUNCTION {make.href.hyperref} +{ + "\href {" swap$ * "} {\path{" * swap$ * "}}" * +} +FUNCTION {make.href} +{ hrefform #2 = + 'make.href.hyperref % hrefform = 2 + { hrefform #1 = + 'make.href.hypertex % hrefform = 1 + 'make.href.null % hrefform = 0 (or anything else) + if$ + } + if$ +} + +% If inlinelinks is true, then format.url should be a no-op, since it's +% (a) redundant, and (b) could end up as a link-within-a-link. +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or + { "" } + { hrefform #1 = + { % special case -- add HyperTeX specials + urlintro "\url{" url * "}" * url make.href.hypertex * } + { urlintro "\url{" * url * "}" * } + if$ + } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiprefix doi * doiurl doi * make.href } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} + % Output a URL. We can't use the more normal idiom (something like % `format.url output'), because the `inbrackets' within % format.lastchecked applies to everything between calls to `output', @@ -630,6 +759,51 @@ FUNCTION {output.url} if$ } +FUNCTION {output.web.refs} +{ + new.block + output.url + addeprints eprint empty$ not and + { format.eprint output.nonnull } + 'skip$ + if$ + adddoiresolver doi empty$ not and + { format.doi output.nonnull } + 'skip$ + if$ + addpubmedresolver pubmed empty$ not and + { format.pubmed output.nonnull } + 'skip$ + if$ +} + +% Wrapper for output.bibitem.original. +% If the URL field is not empty, set makeinlinelink to be true, +% so that an inline link will be started at the next opportunity +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} + +% Wrapper for fin.entry.original +FUNCTION {fin.entry} +{ output.web.refs % urlbst + makeinlinelink % ooops, it appears we didn't have a title for inlinelink + { setup.inlinelink % add some artificial link text here, as a fallback + "[link]" output.nonnull } + 'skip$ + if$ + bracket.state close.brackets = % urlbst + { "]" * } + 'skip$ + if$ + fin.entry.original +} + % Webpage entry type. % Title and url fields required; % author, note, year, month, and lastchecked fields optional @@ -642,10 +816,19 @@ FUNCTION {output.url} FUNCTION {webpage} { output.bibitem author empty$ - 'skip$ - { format.authors output.nonnull } + { editor empty$ + 'skip$ % author and editor both optional + { format.editors output.nonnull } + if$ + } + { editor empty$ + { format.authors output.nonnull } + { "can't use both author and editor fields in " cite$ * warning$ } + if$ + } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ format.title "title" output.check inbrackets "online" output new.block @@ -653,23 +836,22 @@ FUNCTION {webpage} 'skip$ { format.date "year" output.check } if$ - lastchecked empty$ - 'skip$ - { format.lastchecked output } - if$ - new.block - format.url "url" output.check + % We don't need to output the URL details ('lastchecked' and 'url'), + % because fin.entry does that for us, using output.web.refs. The only + % reason we would want to put them here is if we were to decide that + % they should go in front of the rather miscellaneous information in 'note'. new.block note output fin.entry } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -682,8 +864,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -700,6 +880,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -716,8 +897,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -726,14 +905,13 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output address output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -750,6 +928,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -768,8 +947,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -778,6 +955,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -796,8 +974,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -806,6 +982,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -832,8 +1009,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -853,6 +1028,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -870,8 +1046,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -880,6 +1054,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -887,8 +1062,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -897,13 +1070,12 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry empty.misc.check @@ -913,6 +1085,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -920,8 +1093,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -933,6 +1104,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -957,8 +1129,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -967,6 +1137,7 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull @@ -974,8 +1145,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -984,6 +1153,7 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check @@ -1398,6 +1568,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} |