diff options
Diffstat (limited to 'Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst | 528 |
1 files changed, 332 insertions, 196 deletions
diff --git a/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst b/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst index 0c37586d690..d1cc88411e2 100644 --- a/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst +++ b/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldater.bst @@ -5,27 +5,24 @@ %% %% plainhtml.bst %% -%% Part of bibhtml, version 1.3, released 2006 October 31 +%% Part of bibhtml, version 2.0, released 2009 August 9 +%% Hg node 4a5600417b09. %% See <http://purl.org/nxg/dist/bibhtml> %% -%% Copyright 1999, 2005, 2006, Norman Gray <norman@astro.gla.ac.uk> -% -% $Id: plainhtml.bst.in,v 1.2 2006/10/31 15:45:57 norman Exp $ -% -% Released under the terms of the GNU General Public Licence -- -% see the file LICENCE, included in the distribution. -% -% Version history: -% 1.3 31 October 2006: added 'hrefprefix' variable; minor code tidups -% 1.2 19 September 2005: added `webpage' entry type, and -% `lastchecked' field. -% 1.1 6 June 1999. Tidied documenation, clarified licence. -% 1.0b3 April 1998, added support for eprint field -% (in article, techreport, misc, inproceedings, unpublished) -% 1.0b2 December 1996, added the above exhortation! -% 1.0b1 Original version -% -% Modification of... +%% Copyright 1999, 2005, 2006, 2009, Norman Gray <norman@astro.gla.ac.uk> +%% +%% This is a modification of a modification! +%% +%%% Modification of BibTeX style file /usr/local/texlive/2008/texmf-dist/bibtex/bst/base/plain.bst +%%% ... by urlbst, version 0.6-4 (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 `plain' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -35,13 +32,6 @@ % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst. % This restriction helps ensure that all standard styles are identical. % The file btxbst.doc has the documentation for this style. -% ... to make it produce HTML, and add the url field -% -% this produces a file which is a <dl>...</dl>, which should be incorporated -% into another html file somehow. -% There will still be ~ and -- within the output file (it's too difficult -% to get rid of them here). A post-processor should turn these -% into either and &enspace; or ' ' and '-' as required. ENTRY { address @@ -66,47 +56,77 @@ ENTRY type volume year - url - lastchecked - eprint -%EDIT1 - sortmonth + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label } -INTEGERS { output.state before.all mid.sentence after.sentence after.block - close.link } - -STRINGS { s t xxxmirror hrefprefix } - -% Initialise state constants, and location of nearest XXX mirror (for eprints) +INTEGERS { output.state before.all mid.sentence after.sentence after.block doiform } + +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { 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 + #1 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + #1 'doiform := % 0=simple, but can produce invalid HTML; 1=needs post-processing + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by possibly.setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets + close.first.block +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'before.all := +{ #0 'outside.brackets := % urlbst + #1 'open.brackets := + #2 'within.brackets := + #3 'close.brackets := + + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := - #0 'close.link := - - "" 'hrefprefix := % "ref:" is a good alternative - "xxx.arxiv.org" 'xxxmirror := + #0 'close.first.block := } -FUNCTION {output.nonnull} +STRINGS { s t } + +% urlbst +FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = { ", " * write$ } { output.state after.block = { add.period$ write$ % close the <dt> after the end of the first block - % and set closelink false - close.link - { "</a></dt> <dd>" write$ - #0 'close.link := } - 'skip$ - if$ - newline$ - " " write$ + close.first.block + { "</a></dt>" write$ newline$ "<dd>" write$ + #0 'close.first.block := } + { newline$ } + if$ + %"\newblock " write$ } { output.state before.all = 'write$ @@ -120,6 +140,84 @@ FUNCTION {output.nonnull} s } +% 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 {possibly.setup.inlinelink} +{ makeinlinelink + { "<a href=" quote$ * url * quote$ * ">" * 'openinlinelink := + "</a>" 'closeinlinelink := + #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 is currently at the top of the stack, and set bracket.state + % to outside.brackets + bracket.state close.brackets = + { "]" * + outside.brackets 'bracket.state := + } + 'skip$ + if$ + bracket.state outside.brackets = + { % We're outside all brackets -- this is the normal situation. + % Write out what's currently at the top of the stack, using the + % original output.nonnull function. + s + 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 + % state, ready for next time (unless inbrackets resets it). If we come + % into this branch, then output.state is carefully undisturbed. + bracket.state open.brackets = + { " [" * } + { ", " * } % bracket.state will be within.brackets + if$ + s * + close.brackets 'bracket.state := + } + if$ +} + +% Call this function just before adding something which should be presented in +% brackets. bracket.state is handled specially within output.nonnull. +FUNCTION {inbrackets} +{ bracket.state close.brackets = + { within.brackets 'bracket.state := } % reset the state: not open nor closed + { open.brackets 'bracket.state := } + if$ +} + +FUNCTION {format.lastchecked} +{ lastchecked empty$ + { "" } + { inbrackets "cited " lastchecked * } + if$ +} +% ...urlbst to here + FUNCTION {output} { duplicate$ empty$ 'pop$ @@ -135,24 +233,22 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} +FUNCTION {output.bibitem.original} { newline$ - "<dt><a name=" quote$ * hrefprefix * write$ + "<dt><a name='" write$ cite$ write$ - quote$ ">[" * cite$ * "] " * write$ - % the <dt> is closed within output.nonnull, as long as close.link is true - #1 'close.link := -% newline$ + "'>[" cite$ * "] " * write$ + % the <dt> is closed within output.nonnull, as long as close.first.block is true + #1 'close.first.block := + newline$ "" before.all 'output.state := } -FUNCTION {fin.entry} -{ add.period$ +FUNCTION {fin.entry.original} +{ add.period$ "</dd>" * write$ newline$ - "</dd>" write$ - newline$ } FUNCTION {new.block} @@ -287,33 +383,10 @@ FUNCTION {format.editors} if$ } -%FUNCTION {format.title} -%{ title empty$ -% { "" } -% { title "t" change.case$ } -% if$ -%} - -% format the title, and surround it with the URL if one is defined FUNCTION {format.title} { title empty$ { "" } - { url empty$ - { title "t" change.case$ } - { "<a href=" quote$ * url * quote$ * " >" * - title "t" change.case$ * "</a>" * } - if$ - } - if$ -} - -% format the eprint number, and surround it with a URL pointing to -% one of the XXX mirrors -FUNCTION {format.eprint} -{ eprint empty$ - { "" } - { "eprint <a href=" quote$ * "http://" * xxxmirror * "/abs/" * eprint * - quote$ * " >" * eprint * "</a>" * } + { title "t" change.case$ } if$ } @@ -323,7 +396,7 @@ FUNCTION {n.dashify} { t empty$ not } { t #1 #1 substring$ "-" = { t #1 #2 substring$ "--" = not - { "-" * + { "--" * t #2 global.max$ substring$ 't := } { { t #1 #1 substring$ "-" = } @@ -359,24 +432,8 @@ FUNCTION {format.date} if$ } -%FUNCTION {format.btitle} -%{ title emphasize -%} - FUNCTION {format.btitle} -{ title empty$ - { booktitle empty$ - { "need title or booktitle in format.btitle" warning$ } - { booktitle 's := } - if$ - } - { title 's := } - if$ - url empty$ - { s emphasize } - { "<a href=" quote$ * url * quote$ * " >" * - s emphasize * "</a>" * } - if$ +{ title emphasize } FUNCTION {tie.or.space.connect} @@ -472,14 +529,10 @@ FUNCTION {format.pages} } FUNCTION {format.vol.num.pages} -%{ volume field.or.null -{ volume empty$ % allow this... - { "" } - { "<b>" volume * "</b>" * } - if$ +{ volume field.or.null number empty$ 'skip$ - { " no. " number * * + { "(" number * ")" * * volume empty$ { "there's a number but no volume in " cite$ * warning$ } 'skip$ @@ -490,7 +543,7 @@ FUNCTION {format.vol.num.pages} 'skip$ { duplicate$ empty$ { pop$ format.pages } - { " pp. " * pages n.dashify * } + { ":" * pages n.dashify * } if$ } if$ @@ -553,7 +606,6 @@ FUNCTION {format.tr.number} if$ } -% surround the journal name with a link pointing to the crossref FUNCTION {format.article.crossref} { key empty$ { journal empty$ @@ -561,36 +613,28 @@ FUNCTION {format.article.crossref} warning$ "" } - { "In <em><a href=" quote$ * "#" * hrefprefix * crossref * quote$ * ">" * - journal * "</a></em>" * } -% { "In <em>" journal * "</em>" * } + { "In <em>" journal * "</em>" * } if$ } { "In " key * } if$ + " <span class='cite'>" * crossref * "</span>" * } -% if there is indeed a crossref, make the reference a link FUNCTION {format.crossref.editor} -{ crossref empty$ - { editor #1 "{vv~}{ll}" format.name$ - editor num.names$ duplicate$ - #2 > - { pop$ " et~al." * } - { #2 < +{ editor #1 "{vv~}{ll}" format.name$ + editor num.names$ duplicate$ + #2 > + { pop$ " et~al." * } + { #2 < 'skip$ - { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = { " et~al." * } { " and " * editor #2 "{vv~}{ll}" format.name$ * } if$ - } + } if$ - } - if$ - } - { "<a href=" quote$ * "#" * hrefprefix * crossref * quote$ * " >[" * - crossref * "]</a>" * - } + } if$ } @@ -620,7 +664,7 @@ FUNCTION {format.book.crossref} } { format.crossref.editor * } if$ -% "<a href=#" * crossref * ">" * crossref * "</a>" * + " <span class='cite'>" * crossref * "</span>" * } FUNCTION {format.incoll.inproc.crossref} @@ -641,33 +685,169 @@ FUNCTION {format.incoll.inproc.crossref} } { "In " format.crossref.editor * } if$ -% "<a href=#" * crossref * ">" * crossref * "</a>" * -% " \cite{" * crossref * "}" * + " <span class='cite'>" * crossref * "</span>" * } -FUNCTION {format.lastchecked} -{ lastchecked empty$ +% urlbst... +% Functions for making hypertext links. +FUNCTION {make.href} +{ + "<a href='" swap$ * "'><code>" * swap$ * "</code></a>" * +} + +% 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 + { "" } + { urlintro "<code>" * url * "</code>" * } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiform #0 = + { doiprefix doi * doiurl doi * make.href } + { "DOI:{" doi * "}" * } + if$ + } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ { "" } - { ", cited " lastchecked * } + { 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', +% so that `format.url format.lastchecked * output' ends up with both +% the URL and the lastchecked in brackets. +FUNCTION {output.url} +{ url empty$ + 'skip$ + { new.block + format.url output + format.lastchecked output + } + 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 + { possibly.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 +% See references +% ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm +% http://www.classroom.net/classroom/CitingNetResources.html +% http://neal.ctstateu.edu/history/cite.html +% http://www.cas.usf.edu/english/walker/mla.html +% for citation formats for web pages. +FUNCTION {webpage} +{ output.bibitem + author empty$ + { 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$ 'possibly.setup.inlinelink if$ + format.title "title" output.check + inbrackets "online" output + new.block + year empty$ + 'skip$ + { format.date "year" output.check } + if$ + % 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 to here + FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ { journal emphasize "journal" output.check - format.vol.num.pages output + possibly.setup.inlinelink format.vol.num.pages output% urlbst format.date "year" output.check } { format.article.crossref output.nonnull format.pages output } if$ - format.eprint output new.block note output fin.entry @@ -685,6 +865,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -709,6 +890,7 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output @@ -731,6 +913,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -757,6 +940,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -783,6 +967,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -795,11 +980,9 @@ FUNCTION {inproceedings} organization output publisher output format.date "year" output.check - format.eprint output } { address output.nonnull format.date "year" output.check - format.eprint output new.sentence organization output publisher output @@ -830,6 +1013,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -855,6 +1039,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -870,11 +1055,11 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output - format.eprint output new.block note output fin.entry @@ -885,6 +1070,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -903,6 +1089,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -935,13 +1122,13 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull institution "institution" output.check address output format.date "year" output.check - format.eprint output new.block note output fin.entry @@ -951,31 +1138,11 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check format.date output - format.eprint output - fin.entry -} - -FUNCTION {webpage} -{ output.bibitem - author empty$ - { % Need to put something here -- if the title were put here, - % we'd have a <a> inside a <a> - key empty$ - { "" } - { key } - if$ - "author and key" output.check - } - { format.authors "author" output.check } - if$ - new.block - format.title "title" output.check - new.block - "[Online" format.lastchecked * "]" * output fin.entry } @@ -1161,7 +1328,7 @@ FUNCTION {editor.organization.sort} if$ } -FUNCTION {presort.by.author} +FUNCTION {presort} { type$ "book" = type$ "inbook" = or @@ -1189,38 +1356,7 @@ FUNCTION {presort.by.author} 'sort.key$ := } -FUNCTION {presort.by.year} -{ year field.or.null sortify -%EDIT2 - sortmonth field.or.null sortify - * - " " - * - type$ "book" = - type$ "inbook" = - or - 'author.editor.sort - { type$ "proceedings" = - 'editor.organization.sort - { type$ "manual" = - 'author.organization.sort - 'author.sort - if$ - } - if$ - } - if$ - * - " " - * - title field.or.null - sort.format.title - * - #1 entry.max$ substring$ - 'sort.key$ := -} - -ITERATE {presort.by.year} +ITERATE {presort} SORT @@ -1259,6 +1395,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} REVERSE {call.type$} @@ -1269,4 +1406,3 @@ FUNCTION {end.bib} } EXECUTE {end.bib} - |