Debian Codegraph @

texmf-dist/bibtex/bst/urlbst/unsrturl.bst

raw
1 %%% Modification of BibTeX style file /usr/local/texlive/2022/texmf-dist/bibtex/bst/base/unsrt.bst
2 %%% ... by urlbst, version 0.9.1 (marked with "% urlbst")
3 %%% See <https://purl.org/nxg/dist/urlbst> and repository <https://heptapod.host/nxg/urlbst>
4 %%% Modifications Copyright 2002–23, Norman Gray,
5 %%% and distributed under the terms of the LPPL; see README for discussion.
6 %%%
7 %%% Added webpage entry type, and url and lastchecked fields.
8 %%% Added eprint support.
9 %%% Added DOI support.
10 %%% Added PUBMED support.
11 %%% Added hyperref support.
12 %%% Original headers follow...
13
14 % BibTeX standard bibliography style `unsrt'
15 % Version 0.99b (8-Dec-10 release) for BibTeX versions 0.99a or later.
16 % Copyright (C) 1984, 1985, 1988, 2010 Howard Trickey and Oren Patashnik.
17 % Unlimited copying and redistribution of this file are permitted as long as
18 % it is unmodified. Modifications (and redistribution of modified versions)
19 % are also permitted, but only if the resulting file is renamed to something
20 % besides btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
21 % This restriction helps ensure that all standard styles are identical.
22 % The file btxbst.doc has the documentation for this style.
23
24 ENTRY
25 { address
26 author
27 booktitle
28 chapter
29 edition
30 editor
31 howpublished
32 institution
33 journal
34 key
35 month
36 note
37 number
38 organization
39 pages
40 publisher
41 school
42 series
43 title
44 type
45 volume
46 year
47 eprint % urlbst
48 doi % urlbst
49 pubmed % urlbst
50 url % urlbst
51 lastchecked % urlbst
52 }
53 {}
54 { label }
55
56 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
57
58 % urlbst...
59 % urlbst constants and state variables
60 STRINGS { urlintro
61 eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl
62 citedstring onlinestring linktextstring
63 openinlinelink closeinlinelink }
64 INTEGERS { hrefform doiform inlinelinks makeinlinelink
65 addeprints adddoi addpubmed }
66 FUNCTION {init.urlbst.variables}
67 {
68 % The following constants may be adjusted by hand, if desired
69
70 % The first set allow you to enable or disable certain functionality.
71 #1 'addpubmed := % 0=no PUBMED resolver; 1=include it
72 #0 'doiform := % 0=with href; 1=with \doi{}
73 #1 'adddoi := % 0=no DOI resolver; 1=include it
74 #1 'addeprints := % 0=no eprints; 1=include eprints
75 #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles
76 #2 'hrefform := % 0=no crossrefs; 1=hypertex hrefs; 2=hyperref hrefs
77
78 % String constants, which you _might_ want to tweak.
79 "https://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
80 "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
81 "[link]" 'linktextstring := % anonymous link text
82 "URL: " 'urlintro := % text prefix before URL
83 "https://doi.org/" 'doiurl := % prefix to make URL from DOI
84 "cited " 'citedstring := % label in "lastchecked" remark
85 "doi:" 'doiprefix := % printed text to introduce DOI
86 "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
87 "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref
88 "online" 'onlinestring := % label that a resource is online
89
90 % The following are internal state variables, not configuration constants,
91 % so they shouldn't be fiddled with.
92 #0 'makeinlinelink := % state variable managed by possibly.setup.inlinelink
93 "" 'openinlinelink := % ditto
94 "" 'closeinlinelink := % ditto
95 }
96 INTEGERS {
97 bracket.state
98 outside.brackets
99 open.brackets
100 within.brackets
101 close.brackets
102 }
103 % ...urlbst to here
104 FUNCTION {init.state.consts}
105 { #0 'outside.brackets := % urlbst...
106 #1 'open.brackets :=
107 #2 'within.brackets :=
108 #3 'close.brackets := % ...urlbst to here
109
110 #0 'before.all :=
111 #1 'mid.sentence :=
112 #2 'after.sentence :=
113 #3 'after.block :=
114 }
115
116 STRINGS { s t }
117
118 % urlbst
119 FUNCTION {output.nonnull.original}
120 { 's :=
121 output.state mid.sentence =
122 { ", " * write$ }
123 { output.state after.block =
124 { add.period$ write$
125 newline$
126 "\newblock " write$
127 }
128 { output.state before.all =
129 'write$
130 { add.period$ " " * write$ }
131 if$
132 }
133 if$
134 mid.sentence 'output.state :=
135 }
136 if$
137 s
138 }
139
140 % urlbst...
141 % Minimal DOI parsing.
142 % Given a DOI on the stack, check whether it starts with 'doiurl' or not.
143 % In either case, leave on the stack first a DOI with, and then a DOI without, the URL prefix.
144 FUNCTION {parse.doi}
145 {
146 #1 doiurl text.length$ substring$
147 doiurl =
148 { doi
149 doi doiurl text.length$ #1 + #999 substring$ }
150 { doiurl doi *
151 doi }
152 if$
153 }
154 % The following three functions are for handling inlinelink. They wrap
155 % a block of text which is potentially output with write$ by multiple
156 % other functions, so we don't know the content a priori.
157 % They communicate between each other using the variables makeinlinelink
158 % (which is true if a link should be made), and closeinlinelink (which holds
159 % the string which should close any current link. They can be called
160 % at any time, but start.inlinelink will be a no-op unless something has
161 % previously set makeinlinelink true, and the two ...end.inlinelink functions
162 % will only do their stuff if start.inlinelink has previously set
163 % closeinlinelink to be non-empty.
164 % (thanks to 'ijvm' for suggested code here)
165 FUNCTION {uand}
166 { 'skip$ { pop$ #0 } if$ } % 'and' (which isn't defined at this point in the file)
167 FUNCTION {possibly.setup.inlinelink}
168 { makeinlinelink hrefform #0 > uand
169 { doi empty$ adddoi uand
170 { pubmed empty$ addpubmed uand
171 { eprint empty$ addeprints uand
172 { url empty$
173 { "" }
174 { url }
175 if$ }
176 { eprinturl eprint * }
177 if$ }
178 { pubmedurl pubmed * }
179 if$ }
180 % { doiurl doi * }
181 { doi empty$
182 { "XXX" }
183 { doi parse.doi pop$ }
184 if$
185 }
186 if$
187 % an appropriately-formatted URL is now on the stack
188 hrefform #1 = % hypertex
189 { "\special {html:<a href=" quote$ * swap$ * quote$ * "> }{" * 'openinlinelink :=
190 "\special {html:</a>}" 'closeinlinelink := }
191 { "\href {" swap$ * "} {" * 'openinlinelink := % hrefform=#2 -- hyperref
192 % the space between "} {" matters: a URL of just the right length can cause "\% newline em"
193 "}" 'closeinlinelink := }
194 if$
195 #0 'makeinlinelink :=
196 }
197 'skip$
198 if$ % makeinlinelink
199 }
200 FUNCTION {add.inlinelink}
201 { openinlinelink empty$
202 'skip$
203 { openinlinelink swap$ * closeinlinelink *
204 "" 'openinlinelink :=
205 }
206 if$
207 }
208 FUNCTION {output.nonnull}
209 { % Save the thing we've been asked to output
210 's :=
211 % If the bracket-state is close.brackets, then add a close-bracket to
212 % what is currently at the top of the stack, and set bracket.state
213 % to outside.brackets
214 bracket.state close.brackets =
215 { "]" *
216 outside.brackets 'bracket.state :=
217 }
218 'skip$
219 if$
220 bracket.state outside.brackets =
221 { % We're outside all brackets -- this is the normal situation.
222 % Write out what's currently at the top of the stack, using the
223 % original output.nonnull function.
224 s
225 add.inlinelink
226 output.nonnull.original % invoke the original output.nonnull
227 }
228 { % Still in brackets. Add open-bracket or (continuation) comma, add the
229 % new text (in s) to the top of the stack, and move to the close-brackets
230 % state, ready for next time (unless inbrackets resets it). If we come
231 % into this branch, then output.state is carefully undisturbed.
232 bracket.state open.brackets =
233 { " [" * }
234 { ", " * } % bracket.state will be within.brackets
235 if$
236 s *
237 close.brackets 'bracket.state :=
238 }
239 if$
240 }
241
242 % Call this function just before adding something which should be presented in
243 % brackets. bracket.state is handled specially within output.nonnull.
244 FUNCTION {inbrackets}
245 { bracket.state close.brackets =
246 { within.brackets 'bracket.state := } % reset the state: not open nor closed
247 { open.brackets 'bracket.state := }
248 if$
249 }
250
251 FUNCTION {format.lastchecked}
252 { lastchecked empty$
253 { "" }
254 { inbrackets citedstring lastchecked * }
255 if$
256 }
257 % ...urlbst to here
258
259 FUNCTION {output}
260 { duplicate$ empty$
261 'pop$
262 'output.nonnull
263 if$
264 }
265
266 FUNCTION {output.check}
267 { 't :=
268 duplicate$ empty$
269 { pop$ "empty " t * " in " * cite$ * warning$ }
270 'output.nonnull
271 if$
272 }
273
274 FUNCTION {output.bibitem.original} % urlbst (renamed from output.bibitem, so it can be wrapped below)
275 { newline$
276 "\bibitem{" write$
277 cite$ write$
278 "}" write$
279 newline$
280 ""
281 before.all 'output.state :=
282 }
283
284 FUNCTION {fin.entry.original} % urlbst (renamed from fin.entry, so it can be wrapped below)
285 { add.period$
286 write$
287 newline$
288 }
289
290 FUNCTION {new.block}
291 { output.state before.all =
292 'skip$
293 { after.block 'output.state := }
294 if$
295 }
296
297 FUNCTION {new.sentence}
298 { output.state after.block =
299 'skip$
300 { output.state before.all =
301 'skip$
302 { after.sentence 'output.state := }
303 if$
304 }
305 if$
306 }
307
308 FUNCTION {not}
309 { { #0 }
310 { #1 }
311 if$
312 }
313
314 FUNCTION {and}
315 { 'skip$
316 { pop$ #0 }
317 if$
318 }
319
320 FUNCTION {or}
321 { { pop$ #1 }
322 'skip$
323 if$
324 }
325
326 FUNCTION {new.block.checka}
327 { empty$
328 'skip$
329 'new.block
330 if$
331 }
332
333 FUNCTION {new.block.checkb}
334 { empty$
335 swap$ empty$
336 and
337 'skip$
338 'new.block
339 if$
340 }
341
342 FUNCTION {new.sentence.checka}
343 { empty$
344 'skip$
345 'new.sentence
346 if$
347 }
348
349 FUNCTION {new.sentence.checkb}
350 { empty$
351 swap$ empty$
352 and
353 'skip$
354 'new.sentence
355 if$
356 }
357
358 FUNCTION {field.or.null}
359 { duplicate$ empty$
360 { pop$ "" }
361 'skip$
362 if$
363 }
364
365 FUNCTION {emphasize}
366 { duplicate$ empty$
367 { pop$ "" }
368 { "{\em " swap$ * "}" * }
369 if$
370 }
371
372 INTEGERS { nameptr namesleft numnames }
373
374 FUNCTION {format.names}
375 { 's :=
376 #1 'nameptr :=
377 s num.names$ 'numnames :=
378 numnames 'namesleft :=
379 { namesleft #0 > }
380 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
381 nameptr #1 >
382 { namesleft #1 >
383 { ", " * t * }
384 { numnames #2 >
385 { "," * }
386 'skip$
387 if$
388 t "others" =
389 { " et~al." * }
390 { " and " * t * }
391 if$
392 }
393 if$
394 }
395 't
396 if$
397 nameptr #1 + 'nameptr :=
398 namesleft #1 - 'namesleft :=
399 }
400 while$
401 }
402
403 FUNCTION {format.authors}
404 { author empty$
405 { "" }
406 { author format.names }
407 if$
408 }
409
410 FUNCTION {format.editors}
411 { editor empty$
412 { "" }
413 { editor format.names
414 editor num.names$ #1 >
415 { ", editors" * }
416 { ", editor" * }
417 if$
418 }
419 if$
420 }
421
422 FUNCTION {format.title}
423 { title empty$
424 { "" }
425 { title "t" change.case$ }
426 if$
427 }
428
429 FUNCTION {n.dashify}
430 { 't :=
431 ""
432 { t empty$ not }
433 { t #1 #1 substring$ "-" =
434 { t #1 #2 substring$ "--" = not
435 { "--" *
436 t #2 global.max$ substring$ 't :=
437 }
438 { { t #1 #1 substring$ "-" = }
439 { "-" *
440 t #2 global.max$ substring$ 't :=
441 }
442 while$
443 }
444 if$
445 }
446 { t #1 #1 substring$ *
447 t #2 global.max$ substring$ 't :=
448 }
449 if$
450 }
451 while$
452 }
453
454 FUNCTION {format.date}
455 { year empty$
456 { month empty$
457 { "" }
458 { "there's a month but no year in " cite$ * warning$
459 month
460 }
461 if$
462 }
463 { month empty$
464 'year
465 { month " " * year * }
466 if$
467 }
468 if$
469 }
470
471 FUNCTION {format.btitle}
472 { title emphasize
473 }
474
475 FUNCTION {tie.or.space.connect}
476 { duplicate$ text.length$ #3 <
477 { "~" }
478 { " " }
479 if$
480 swap$ * *
481 }
482
483 FUNCTION {either.or.check}
484 { empty$
485 'pop$
486 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
487 if$
488 }
489
490 FUNCTION {format.bvolume}
491 { volume empty$
492 { "" }
493 { "volume" volume tie.or.space.connect
494 series empty$
495 'skip$
496 { " of " * series emphasize * }
497 if$
498 "volume and number" number either.or.check
499 }
500 if$
501 }
502
503 FUNCTION {format.number.series}
504 { volume empty$
505 { number empty$
506 { series field.or.null }
507 { output.state mid.sentence =
508 { "number" }
509 { "Number" }
510 if$
511 number tie.or.space.connect
512 series empty$
513 { "there's a number but no series in " cite$ * warning$ }
514 { " in " * series * }
515 if$
516 }
517 if$
518 }
519 { "" }
520 if$
521 }
522
523 FUNCTION {format.edition}
524 { edition empty$
525 { "" }
526 { output.state mid.sentence =
527 { edition "l" change.case$ " edition" * }
528 { edition "t" change.case$ " edition" * }
529 if$
530 }
531 if$
532 }
533
534 INTEGERS { multiresult }
535
536 FUNCTION {multi.page.check}
537 { 't :=
538 #0 'multiresult :=
539 { multiresult not
540 t empty$ not
541 and
542 }
543 { t #1 #1 substring$
544 duplicate$ "-" =
545 swap$ duplicate$ "," =
546 swap$ "+" =
547 or or
548 { #1 'multiresult := }
549 { t #2 global.max$ substring$ 't := }
550 if$
551 }
552 while$
553 multiresult
554 }
555
556 FUNCTION {format.pages}
557 { pages empty$
558 { "" }
559 { pages multi.page.check
560 { "pages" pages n.dashify tie.or.space.connect }
561 { "page" pages tie.or.space.connect }
562 if$
563 }
564 if$
565 }
566
567 FUNCTION {format.vol.num.pages}
568 { volume field.or.null
569 number empty$
570 'skip$
571 { "(" number * ")" * *
572 volume empty$
573 { "there's a number but no volume in " cite$ * warning$ }
574 'skip$
575 if$
576 }
577 if$
578 pages empty$
579 'skip$
580 { duplicate$ empty$
581 { pop$ format.pages }
582 { ":" * pages n.dashify * }
583 if$
584 }
585 if$
586 }
587
588 FUNCTION {format.chapter.pages}
589 { chapter empty$
590 'format.pages
591 { type empty$
592 { "chapter" }
593 { type "l" change.case$ }
594 if$
595 chapter tie.or.space.connect
596 pages empty$
597 'skip$
598 { ", " * format.pages * }
599 if$
600 }
601 if$
602 }
603
604 FUNCTION {format.in.ed.booktitle}
605 { booktitle empty$
606 { "" }
607 { editor empty$
608 { "In " booktitle emphasize * }
609 { "In " format.editors * ", " * booktitle emphasize * }
610 if$
611 }
612 if$
613 }
614
615 FUNCTION {empty.misc.check}
616 { author empty$ title empty$ howpublished empty$
617 month empty$ year empty$ note empty$
618 and and and and and
619 { "all relevant fields are empty in " cite$ * warning$ }
620 'skip$
621 if$
622 }
623
624 FUNCTION {format.thesis.type}
625 { type empty$
626 'skip$
627 { pop$
628 type "t" change.case$
629 }
630 if$
631 }
632
633 FUNCTION {format.tr.number}
634 { type empty$
635 { "Technical Report" }
636 'type
637 if$
638 number empty$
639 { "t" change.case$ }
640 { number tie.or.space.connect }
641 if$
642 }
643
644 FUNCTION {format.article.crossref}
645 { key empty$
646 { journal empty$
647 { "need key or journal for " cite$ * " to crossref " * crossref *
648 warning$
649 ""
650 }
651 { "In {\em " journal * "\/}" * }
652 if$
653 }
654 { "In " key * }
655 if$
656 " \cite{" * crossref * "}" *
657 }
658
659 FUNCTION {format.crossref.editor}
660 { editor #1 "{vv~}{ll}" format.name$
661 editor num.names$ duplicate$
662 #2 >
663 { pop$ " et~al." * }
664 { #2 <
665 'skip$
666 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
667 { " et~al." * }
668 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
669 if$
670 }
671 if$
672 }
673 if$
674 }
675
676 FUNCTION {format.book.crossref}
677 { volume empty$
678 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
679 "In "
680 }
681 { "Volume" volume tie.or.space.connect
682 " of " *
683 }
684 if$
685 editor empty$
686 editor field.or.null author field.or.null =
687 or
688 { key empty$
689 { series empty$
690 { "need editor, key, or series for " cite$ * " to crossref " *
691 crossref * warning$
692 "" *
693 }
694 { "{\em " * series * "\/}" * }
695 if$
696 }
697 { key * }
698 if$
699 }
700 { format.crossref.editor * }
701 if$
702 " \cite{" * crossref * "}" *
703 }
704
705 FUNCTION {format.incoll.inproc.crossref}
706 { editor empty$
707 editor field.or.null author field.or.null =
708 or
709 { key empty$
710 { booktitle empty$
711 { "need editor, key, or booktitle for " cite$ * " to crossref " *
712 crossref * warning$
713 ""
714 }
715 { "In {\em " booktitle * "\/}" * }
716 if$
717 }
718 { "In " key * }
719 if$
720 }
721 { "In " format.crossref.editor * }
722 if$
723 " \cite{" * crossref * "}" *
724 }
725
726 % urlbst...
727 % Functions for making hypertext links.
728 % In all cases, the stack has (link-text href-url)
729 %
730 % make 'null' specials
731 FUNCTION {make.href.null}
732 {
733 pop$
734 }
735 % make hypertex specials
736 FUNCTION {make.href.hypertex}
737 {
738 "\special {html:<a href=" quote$ *
739 swap$ * quote$ * "> }" * swap$ *
740 "\special {html:</a>}" *
741 }
742 % make hyperref specials
743 FUNCTION {make.href.hyperref}
744 {
745 "\href {" swap$ * "} {\path{" * swap$ * "}}" *
746 }
747 FUNCTION {make.href}
748 { hrefform #2 =
749 'make.href.hyperref % hrefform = 2
750 { hrefform #1 =
751 'make.href.hypertex % hrefform = 1
752 'make.href.null % hrefform = 0 (or anything else)
753 if$
754 }
755 if$
756 }
757
758 % If inlinelinks is true, then format.url should be a no-op, since it's
759 % (a) redundant, and (b) could end up as a link-within-a-link.
760 FUNCTION {format.url}
761 { inlinelinks #1 = url empty$ or
762 { "" }
763 { hrefform #1 =
764 { % special case -- add HyperTeX specials
765 urlintro "\url{" url * "}" * url make.href.hypertex * }
766 { urlintro "\url{" * url * "}" * }
767 if$
768 }
769 if$
770 }
771 FUNCTION {format.eprint}
772 { eprint empty$
773 { "" }
774 { eprintprefix eprint * eprinturl eprint * make.href }
775 if$
776 }
777
778 FUNCTION {format.doi}
779 { doi empty$
780 { "" }
781 { doi parse.doi % leaves "https://doi.org/DOI" DOI on the stack
782 's := 't :=
783 doiform #1 =
784 { "\doi{" s * "}" * }
785 { doiprefix s * t make.href }
786 if$
787 }
788 if$
789 }
790
791 FUNCTION {format.pubmed}
792 { pubmed empty$
793 { "" }
794 { pubmedprefix pubmed * pubmedurl pubmed * make.href }
795 if$
796 }
797
798 % Output a URL. We can't use the more normal idiom (something like
799 % `format.url output'), because the `inbrackets' within
800 % format.lastchecked applies to everything between calls to `output',
801 % so that `format.url format.lastchecked * output' ends up with both
802 % the URL and the lastchecked in brackets.
803 FUNCTION {output.url}
804 { url empty$
805 'skip$
806 { new.block
807 format.url output
808 format.lastchecked output
809 }
810 if$
811 }
812
813 FUNCTION {output.web.refs}
814 {
815 new.block
816 inlinelinks
817 'skip$ % links were inline -- don't repeat them
818 { % If the generated DOI will be the same as the URL,
819 % then don't print the URL (thanks to Joseph Wright
820 % for (the original version of) this code,
821 % at http://tex.stackexchange.com/questions/5660)
822 adddoi
823 doi empty$ { "X" } { doi parse.doi pop$ } if$ % DOI URL to be generated
824 url empty$ { "Y" } { url } if$ % the URL, or "Y" if empty
825 = % are the strings equal?
826 and
827 'skip$
828 { output.url }
829 if$
830 addeprints eprint empty$ not and
831 { format.eprint output.nonnull }
832 'skip$
833 if$
834 adddoi doi empty$ not and
835 { format.doi output.nonnull }
836 'skip$
837 if$
838 addpubmed pubmed empty$ not and
839 { format.pubmed output.nonnull }
840 'skip$
841 if$
842 }
843 if$
844 }
845
846 % Wrapper for output.bibitem.original.
847 % If the URL field is not empty, set makeinlinelink to be true,
848 % so that an inline link will be started at the next opportunity
849 FUNCTION {output.bibitem}
850 { outside.brackets 'bracket.state :=
851 output.bibitem.original
852 inlinelinks url empty$ not doi empty$ not or pubmed empty$ not or eprint empty$ not or and
853 { #1 'makeinlinelink := }
854 { #0 'makeinlinelink := }
855 if$
856 }
857
858 % Wrapper for fin.entry.original
859 FUNCTION {fin.entry}
860 { output.web.refs % urlbst
861 makeinlinelink % ooops, it appears we didn't have a title for inlinelink
862 { possibly.setup.inlinelink % add some artificial link text here, as a fallback
863 linktextstring output.nonnull }
864 'skip$
865 if$
866 bracket.state close.brackets = % urlbst
867 { "]" * }
868 'skip$
869 if$
870 fin.entry.original
871 }
872
873 % Webpage entry type.
874 % Title and url fields required;
875 % author, note, year, month, and lastchecked fields optional
876 % See references
877 % ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm
878 % http://www.classroom.net/classroom/CitingNetResources.html
879 % http://neal.ctstateu.edu/history/cite.html
880 % http://www.cas.usf.edu/english/walker/mla.html
881 % for citation formats for web pages.
882 FUNCTION {webpage}
883 { output.bibitem
884 author empty$
885 { editor empty$
886 'skip$ % author and editor both optional
887 { format.editors output.nonnull }
888 if$
889 }
890 { editor empty$
891 { format.authors output.nonnull }
892 { "can't use both author and editor fields in " cite$ * warning$ }
893 if$
894 }
895 if$
896 new.block
897 title empty$ 'skip$ 'possibly.setup.inlinelink if$
898 format.title "title" output.check
899 inbrackets onlinestring output
900 new.block
901 year empty$
902 'skip$
903 { format.date "year" output.check }
904 if$
905 % We don't need to output the URL details ('lastchecked' and 'url'),
906 % because fin.entry does that for us, using output.web.refs. The only
907 % reason we would want to put them here is if we were to decide that
908 % they should go in front of the rather miscellaneous information in 'note'.
909 new.block
910 note output
911 fin.entry
912 }
913 % ...urlbst to here
914
915
916 FUNCTION {article}
917 { output.bibitem
918 format.authors "author" output.check
919 new.block
920 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
921 format.title "title" output.check
922 new.block
923 crossref missing$
924 { journal emphasize "journal" output.check
925 possibly.setup.inlinelink format.vol.num.pages output% urlbst
926 format.date "year" output.check
927 }
928 { format.article.crossref output.nonnull
929 format.pages output
930 }
931 if$
932 new.block
933 note output
934 fin.entry
935 }
936
937 FUNCTION {book}
938 { output.bibitem
939 author empty$
940 { format.editors "author and editor" output.check }
941 { format.authors output.nonnull
942 crossref missing$
943 { "author and editor" editor either.or.check }
944 'skip$
945 if$
946 }
947 if$
948 new.block
949 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
950 format.btitle "title" output.check
951 crossref missing$
952 { format.bvolume output
953 new.block
954 format.number.series output
955 new.sentence
956 publisher "publisher" output.check
957 address output
958 }
959 { new.block
960 format.book.crossref output.nonnull
961 }
962 if$
963 format.edition output
964 format.date "year" output.check
965 new.block
966 note output
967 fin.entry
968 }
969
970 FUNCTION {booklet}
971 { output.bibitem
972 format.authors output
973 new.block
974 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
975 format.title "title" output.check
976 howpublished address new.block.checkb
977 howpublished output
978 address output
979 format.date output
980 new.block
981 note output
982 fin.entry
983 }
984
985 FUNCTION {inbook}
986 { output.bibitem
987 author empty$
988 { format.editors "author and editor" output.check }
989 { format.authors output.nonnull
990 crossref missing$
991 { "author and editor" editor either.or.check }
992 'skip$
993 if$
994 }
995 if$
996 new.block
997 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
998 format.btitle "title" output.check
999 crossref missing$
1000 { format.bvolume output
1001 format.chapter.pages "chapter and pages" output.check
1002 new.block
1003 format.number.series output
1004 new.sentence
1005 publisher "publisher" output.check
1006 address output
1007 }
1008 { format.chapter.pages "chapter and pages" output.check
1009 new.block
1010 format.book.crossref output.nonnull
1011 }
1012 if$
1013 format.edition output
1014 format.date "year" output.check
1015 new.block
1016 note output
1017 fin.entry
1018 }
1019
1020 FUNCTION {incollection}
1021 { output.bibitem
1022 format.authors "author" output.check
1023 new.block
1024 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1025 format.title "title" output.check
1026 new.block
1027 crossref missing$
1028 { format.in.ed.booktitle "booktitle" output.check
1029 format.bvolume output
1030 format.number.series output
1031 format.chapter.pages output
1032 new.sentence
1033 publisher "publisher" output.check
1034 address output
1035 format.edition output
1036 format.date "year" output.check
1037 }
1038 { format.incoll.inproc.crossref output.nonnull
1039 format.chapter.pages output
1040 }
1041 if$
1042 new.block
1043 note output
1044 fin.entry
1045 }
1046
1047 FUNCTION {inproceedings}
1048 { output.bibitem
1049 format.authors "author" output.check
1050 new.block
1051 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1052 format.title "title" output.check
1053 new.block
1054 crossref missing$
1055 { format.in.ed.booktitle "booktitle" output.check
1056 format.bvolume output
1057 format.number.series output
1058 format.pages output
1059 address empty$
1060 { organization publisher new.sentence.checkb
1061 organization output
1062 publisher output
1063 format.date "year" output.check
1064 }
1065 { address output.nonnull
1066 format.date "year" output.check
1067 new.sentence
1068 organization output
1069 publisher output
1070 }
1071 if$
1072 }
1073 { format.incoll.inproc.crossref output.nonnull
1074 format.pages output
1075 }
1076 if$
1077 new.block
1078 note output
1079 fin.entry
1080 }
1081
1082 FUNCTION {conference} { inproceedings }
1083
1084 FUNCTION {manual}
1085 { output.bibitem
1086 author empty$
1087 { organization empty$
1088 'skip$
1089 { organization output.nonnull
1090 address output
1091 }
1092 if$
1093 }
1094 { format.authors output.nonnull }
1095 if$
1096 new.block
1097 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1098 format.btitle "title" output.check
1099 author empty$
1100 { organization empty$
1101 { address new.block.checka
1102 address output
1103 }
1104 'skip$
1105 if$
1106 }
1107 { organization address new.block.checkb
1108 organization output
1109 address output
1110 }
1111 if$
1112 format.edition output
1113 format.date output
1114 new.block
1115 note output
1116 fin.entry
1117 }
1118
1119 FUNCTION {mastersthesis}
1120 { output.bibitem
1121 format.authors "author" output.check
1122 new.block
1123 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1124 format.title "title" output.check
1125 new.block
1126 "Master's thesis" format.thesis.type output.nonnull
1127 school "school" output.check
1128 address output
1129 format.date "year" output.check
1130 new.block
1131 note output
1132 fin.entry
1133 }
1134
1135 FUNCTION {misc}
1136 { output.bibitem
1137 format.authors output
1138 title howpublished new.block.checkb
1139 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1140 format.title output
1141 howpublished new.block.checka
1142 howpublished output
1143 format.date output
1144 new.block
1145 note output
1146 fin.entry
1147 empty.misc.check
1148 }
1149
1150 FUNCTION {phdthesis}
1151 { output.bibitem
1152 format.authors "author" output.check
1153 new.block
1154 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1155 format.btitle "title" output.check
1156 new.block
1157 "PhD thesis" format.thesis.type output.nonnull
1158 school "school" output.check
1159 address output
1160 format.date "year" output.check
1161 new.block
1162 note output
1163 fin.entry
1164 }
1165
1166 FUNCTION {proceedings}
1167 { output.bibitem
1168 editor empty$
1169 { organization output }
1170 { format.editors output.nonnull }
1171 if$
1172 new.block
1173 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1174 format.btitle "title" output.check
1175 format.bvolume output
1176 format.number.series output
1177 address empty$
1178 { editor empty$
1179 { publisher new.sentence.checka }
1180 { organization publisher new.sentence.checkb
1181 organization output
1182 }
1183 if$
1184 publisher output
1185 format.date "year" output.check
1186 }
1187 { address output.nonnull
1188 format.date "year" output.check
1189 new.sentence
1190 editor empty$
1191 'skip$
1192 { organization output }
1193 if$
1194 publisher output
1195 }
1196 if$
1197 new.block
1198 note output
1199 fin.entry
1200 }
1201
1202 FUNCTION {techreport}
1203 { output.bibitem
1204 format.authors "author" output.check
1205 new.block
1206 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1207 format.title "title" output.check
1208 new.block
1209 format.tr.number output.nonnull
1210 institution "institution" output.check
1211 address output
1212 format.date "year" output.check
1213 new.block
1214 note output
1215 fin.entry
1216 }
1217
1218 FUNCTION {unpublished}
1219 { output.bibitem
1220 format.authors "author" output.check
1221 new.block
1222 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1223 format.title "title" output.check
1224 new.block
1225 note "note" output.check
1226 format.date output
1227 fin.entry
1228 }
1229
1230 FUNCTION {default.type} { misc }
1231
1232 MACRO {jan} {"January"}
1233
1234 MACRO {feb} {"February"}
1235
1236 MACRO {mar} {"March"}
1237
1238 MACRO {apr} {"April"}
1239
1240 MACRO {may} {"May"}
1241
1242 MACRO {jun} {"June"}
1243
1244 MACRO {jul} {"July"}
1245
1246 MACRO {aug} {"August"}
1247
1248 MACRO {sep} {"September"}
1249
1250 MACRO {oct} {"October"}
1251
1252 MACRO {nov} {"November"}
1253
1254 MACRO {dec} {"December"}
1255
1256 MACRO {acmcs} {"ACM Computing Surveys"}
1257
1258 MACRO {acta} {"Acta Informatica"}
1259
1260 MACRO {cacm} {"Communications of the ACM"}
1261
1262 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1263
1264 MACRO {ibmsj} {"IBM Systems Journal"}
1265
1266 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1267
1268 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1269
1270 MACRO {ieeetcad}
1271 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1272
1273 MACRO {ipl} {"Information Processing Letters"}
1274
1275 MACRO {jacm} {"Journal of the ACM"}
1276
1277 MACRO {jcss} {"Journal of Computer and System Sciences"}
1278
1279 MACRO {scp} {"Science of Computer Programming"}
1280
1281 MACRO {sicomp} {"SIAM Journal on Computing"}
1282
1283 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1284
1285 MACRO {tods} {"ACM Transactions on Database Systems"}
1286
1287 MACRO {tog} {"ACM Transactions on Graphics"}
1288
1289 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1290
1291 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1292
1293 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1294
1295 MACRO {tcs} {"Theoretical Computer Science"}
1296
1297 READ
1298
1299 STRINGS { longest.label }
1300
1301 INTEGERS { number.label longest.label.width }
1302
1303 FUNCTION {initialize.longest.label}
1304 { "" 'longest.label :=
1305 #1 'number.label :=
1306 #0 'longest.label.width :=
1307 }
1308
1309 FUNCTION {longest.label.pass}
1310 { number.label int.to.str$ 'label :=
1311 number.label #1 + 'number.label :=
1312 label width$ longest.label.width >
1313 { label 'longest.label :=
1314 label width$ 'longest.label.width :=
1315 }
1316 'skip$
1317 if$
1318 }
1319
1320 EXECUTE {initialize.longest.label}
1321
1322 ITERATE {longest.label.pass}
1323
1324 FUNCTION {begin.bib}
1325 { preamble$ empty$
1326 'skip$
1327 { preamble$ write$ newline$ }
1328 if$
1329 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1330 }
1331
1332 EXECUTE {begin.bib}
1333
1334 EXECUTE {init.urlbst.variables} % urlbst
1335 EXECUTE {init.state.consts}
1336
1337 ITERATE {call.type$}
1338
1339 FUNCTION {end.bib}
1340 { newline$
1341 "\end{thebibliography}" write$ newline$
1342 }
1343
1344 EXECUTE {end.bib}