diff options
Diffstat (limited to 'Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst | 303 |
1 files changed, 237 insertions, 66 deletions
diff --git a/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst b/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst index 7c4426bd0dc..602c0f105c7 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/unsrt.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/unsrt.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 `unsrt' % 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 } 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$ cite$ write$ "}" write$ @@ -164,13 +232,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$ } @@ -611,7 +674,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', @@ -627,6 +756,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 @@ -639,10 +813,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 @@ -650,23 +833,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$ @@ -679,8 +861,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -697,6 +877,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -713,8 +894,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -723,14 +902,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 } @@ -747,6 +925,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -765,8 +944,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -775,6 +952,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$ @@ -793,8 +971,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -803,6 +979,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$ @@ -829,8 +1006,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -850,6 +1025,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$ @@ -867,8 +1043,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -877,6 +1051,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 @@ -884,8 +1059,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -894,13 +1067,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 @@ -910,6 +1082,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 @@ -917,8 +1090,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -930,6 +1101,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 @@ -954,8 +1126,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -964,6 +1134,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 @@ -971,8 +1142,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -981,6 +1150,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 @@ -1092,6 +1262,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} |