diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-14 23:55:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-14 23:55:17 +0000 |
commit | 0d16b3b7e2ce00f9de58a809a4ce47b39aaef068 (patch) | |
tree | 791c0999c492978ee744af2cb14e3605c135ba2d /Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst | |
parent | 8c1962d0507c747e0e1a8870dfd758365c5f63ff (diff) |
bibhtml 2.0 (9aug09)
git-svn-id: svn://tug.org/texlive/trunk@14680 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst | 397 |
1 files changed, 260 insertions, 137 deletions
diff --git a/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst b/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst index 757df83c9e0..0e1b81efac7 100644 --- a/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst +++ b/Master/texmf-dist/bibtex/bst/bibhtml/plainhtmldate.bst @@ -5,10 +5,23 @@ %% %% 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> +%% 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... ENTRY { address author @@ -32,38 +45,66 @@ ENTRY type volume year - url - lastchecked - eprint - 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 } +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 } +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 + #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 +} 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 } +FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = { ", " * write$ } { output.state after.block = { add.period$ write$ - 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$ } { output.state before.all = 'write$ @@ -76,6 +117,59 @@ FUNCTION {output.nonnull} if$ s } +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 := + bracket.state close.brackets = + { "]" * + outside.brackets 'bracket.state := + } + 'skip$ + if$ + bracket.state outside.brackets = + { % We're outside all brackets -- this is the normal situation. + s + add.inlinelink + output.nonnull.original % invoke the original output.nonnull + } + { % Still in brackets. Add open-bracket or (continuation) comma, add the + bracket.state open.brackets = + { " [" * } + { ", " * } % bracket.state will be within.brackets + if$ + s * + close.brackets 'bracket.state := + } + if$ +} +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$ +} FUNCTION {output} { duplicate$ empty$ 'pop$ @@ -89,21 +183,20 @@ FUNCTION {output.check} 'output.nonnull if$ } -FUNCTION {output.bibitem} +FUNCTION {output.bibitem.original} { newline$ - "<dt><a name=" quote$ * hrefprefix * write$ + "<dt><a name='" write$ cite$ write$ - quote$ ">[" * cite$ * "] " * write$ - #1 'close.link := + "'>[" cite$ * "] " * write$ + #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} { output.state before.all = @@ -225,19 +318,7 @@ FUNCTION {format.editors} FUNCTION {format.title} { title empty$ { "" } - { url empty$ - { title "t" change.case$ } - { "<a href=" quote$ * url * quote$ * " >" * - title "t" change.case$ * "</a>" * } - if$ - } - if$ -} -FUNCTION {format.eprint} -{ eprint empty$ - { "" } - { "eprint <a href=" quote$ * "http://" * xxxmirror * "/abs/" * eprint * - quote$ * " >" * eprint * "</a>" * } + { title "t" change.case$ } if$ } FUNCTION {n.dashify} @@ -246,7 +327,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$ "-" = } @@ -281,19 +362,7 @@ FUNCTION {format.date} if$ } 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} { duplicate$ text.length$ #3 < @@ -380,13 +449,10 @@ FUNCTION {format.pages} if$ } FUNCTION {format.vol.num.pages} -{ 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$ @@ -397,7 +463,7 @@ FUNCTION {format.vol.num.pages} 'skip$ { duplicate$ empty$ { pop$ format.pages } - { " pp. " * pages n.dashify * } + { ":" * pages n.dashify * } if$ } if$ @@ -461,33 +527,27 @@ FUNCTION {format.article.crossref} warning$ "" } - { "In <em><a href=" quote$ * "#" * hrefprefix * crossref * quote$ * ">" * - journal * "</a></em>" * } + { "In <em>" journal * "</em>" * } if$ } { "In " key * } if$ + " <span class='cite'>" * crossref * "</span>" * } 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$ } FUNCTION {format.book.crossref} @@ -516,6 +576,7 @@ FUNCTION {format.book.crossref} } { format.crossref.editor * } if$ + " <span class='cite'>" * crossref * "</span>" * } FUNCTION {format.incoll.inproc.crossref} { editor empty$ @@ -535,29 +596,130 @@ FUNCTION {format.incoll.inproc.crossref} } { "In " format.crossref.editor * } if$ + " <span class='cite'>" * crossref * "</span>" * } -FUNCTION {format.lastchecked} -{ lastchecked empty$ +FUNCTION {make.href} +{ + "<a href='" swap$ * "'><code>" * swap$ * "</code></a>" * +} +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or { "" } - { ", cited " lastchecked * } + { 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$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} +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$ +} +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} +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 +} +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$ + new.block + note output + fin.entry +} 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 @@ -574,6 +736,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -597,6 +760,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 @@ -618,6 +782,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -643,6 +808,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$ @@ -668,6 +834,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$ @@ -680,11 +847,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 @@ -713,6 +878,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$ @@ -737,6 +903,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 @@ -751,11 +918,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 @@ -765,6 +932,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 @@ -782,6 +950,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 @@ -813,13 +982,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 @@ -828,29 +997,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, - 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 } FUNCTION {default.type} { misc } @@ -992,7 +1143,7 @@ FUNCTION {editor.organization.sort} { editor sort.format.names } if$ } -FUNCTION {presort.by.author} +FUNCTION {presort} { type$ "book" = type$ "inbook" = or @@ -1019,36 +1170,7 @@ FUNCTION {presort.by.author} #1 entry.max$ substring$ 'sort.key$ := } -FUNCTION {presort.by.year} -{ year field.or.null sortify - 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 STRINGS { longest.label } INTEGERS { number.label longest.label.width } @@ -1077,6 +1199,7 @@ FUNCTION {begin.bib} "<dl>" write$ newline$ } EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} FUNCTION {end.bib} |