Debian Codegraph @

texmf-dist/bibtex/bst/directory/address-html.bst

raw
1 %% address-html.bst
2 %% Copyright 1998-2003 Christophe Geuzaine <[email protected]>
3 %
4 % $Id: address-html.bst,v 1.8 2004/02/07 23:41:45 geuzaine Exp $
5 %
6 % This program can be redistributed and/or modified under the terms
7 % of the LaTeX Project Public License distributed from CTAN
8 % archives in directory macros/latex/base/lppl.txt; either
9 % version 1 of the License, or (at your option) any later version.
10 %
11 % BibTeX bibliography style `address-html.bst'
12 % 'directory' database: all fields
13 %
14 % This is definitively a hack...
15 %
16 % The parts you may want to customize are labeled with "CUSTOM"
17 %
18
19 INTEGERS { nameptr namesleft numnames numaux len }
20 STRINGS { s t u v }
21
22 % ------------------------------------------------------------
23 % E N T R I E S
24 % ------------------------------------------------------------
25
26 ENTRY
27 { name
28 nickname
29 birthday
30 birthyear
31 address % if empty, use street, city, ...
32 street
33 city
34 state
35 zip
36 country
37 phone
38 cellular
39 fax
40 email
41 url
42 account
43 p.address % if empty, use p.street, p.city, ...
44 p.street
45 p.city
46 p.state
47 p.zip
48 p.country
49 p.phone
50 p.cellular
51 p.fax
52 p.email
53 p.url
54 p.account
55 r.address % if empty, use r.street, r.city, ...
56 r.street
57 r.city
58 r.state
59 r.zip
60 r.country
61 r.phone
62 r.cellular
63 r.fax
64 r.email
65 r.url
66 r.account
67 w.title
68 w.name
69 w.address % if empty, use w.street, w.city, ...
70 w.street
71 w.city
72 w.state
73 w.zip
74 w.country
75 w.phone
76 w.cellular
77 w.fax
78 w.email
79 w.url
80 w.account
81 note
82 }
83 {}
84 { birthday.str
85 private.str
86 residence.str
87 work.str
88 note.str
89 and.str
90 nickname.str
91 address.str
92 phone.str
93 cellular.str
94 fax.str
95 email.str
96 url.str
97 account.str
98 title.str
99 name.str
100 }
101
102
103 % ------------------------------------------------------------
104 % G E N E R A L
105 % ------------------------------------------------------------
106
107 FUNCTION {init.strings}
108 {
109
110 % CUSOTM this is the 'html' equivalent for the \dirXXX customization
111 % commands
112
113 "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>birthday</em></dt>" 'birthday.str :=
114 "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>home</em></dt>" 'private.str :=
115 "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>residence</em></dt>" 'residence.str :=
116 "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>workplace</em></dt>" 'work.str :=
117 "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>note</em></dt>" 'note.str :=
118
119 " and " 'and.str :=
120 " aka " 'nickname.str :=
121 "" 'address.str :=
122 "Tel: " 'phone.str :=
123 "Mobile: " 'cellular.str :=
124 "Fax: " 'fax.str :=
125 "" 'email.str :=
126 "" 'url.str :=
127 "Account: " 'account.str :=
128 "" 'title.str :=
129 "" 'name.str :=
130 }
131
132 FUNCTION {output.nonnull}
133 { 's :=
134 write$
135 newline$
136 "<dd> " write$
137 s
138 }
139
140 FUNCTION {output}
141 { duplicate$ empty$
142 'pop$
143 'output.nonnull
144 if$
145 }
146
147 FUNCTION {not}
148 { { #0 }
149 { #1 }
150 if$
151 }
152
153 FUNCTION {and}
154 { 'skip$
155 { pop$ #0 }
156 if$
157 }
158
159 FUNCTION {or}
160 { { pop$ #1 }
161 'skip$
162 if$
163 }
164
165 FUNCTION {chop.word}
166 { 's :=
167 'len :=
168 s #1 len substring$ =
169 { s len #1 + global.max$ substring$ }
170 's
171 if$
172 }
173
174 FUNCTION {emailize}
175 { duplicate$ empty$
176 { pop$ "" }
177 { "<A HREF=" quote$ * "mailto:" * swap$ * quote$ * " >" * swap$ * "</A>" * }
178 if$
179 }
180
181 FUNCTION {urlize}
182 { duplicate$ empty$
183 { pop$ "" }
184 { "<A HREF=" quote$ * swap$ * quote$ * " >" * swap$ * "</A>" * }
185 if$
186 }
187
188 FUNCTION {ttize}
189 { duplicate$ empty$
190 { pop$ "" }
191 { "<tt>" swap$ * "</tt>" * }
192 if$
193 }
194
195 % ------------------------------------------------------------
196 % S O R T I N G F U N C T I O N S
197 % ------------------------------------------------------------
198
199 FUNCTION {sortify}
200 { purify$
201 "l" change.case$
202 }
203
204 FUNCTION {sort.names}
205 { 's :=
206 #1 'nameptr :=
207 ""
208 s num.names$ 'numnames :=
209 numnames 'namesleft :=
210 { namesleft #0 > }
211 { nameptr #1 >
212 { " " * }
213 'skip$
214 if$
215 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
216 nameptr numnames = t "others" = and
217 { "et al" * }
218 { t sortify * }
219 if$
220 nameptr #1 + 'nameptr :=
221 namesleft #1 - 'namesleft :=
222 }
223 while$
224 }
225
226
227 FUNCTION {sort.raw.names}
228 { 't :=
229 "A " #2 "L'" #2
230 "An " #3 "Au " #3 "Le " #3 "La " #3
231 "The " #4 "Les " #4 "Aux " #4
232 t
233 chop.word chop.word
234 chop.word chop.word chop.word chop.word
235 chop.word chop.word chop.word
236 sortify
237 #1 global.max$ substring$
238 }
239
240 FUNCTION {name.sort}
241 { name empty$
242 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
243 { name sort.names }
244 if$
245 }
246
247 FUNCTION {raw.name.sort}
248 { name empty$
249 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
250 { name sort.raw.names }
251 if$
252 }
253
254 FUNCTION {presort}
255 { type$ "company" =
256 type$ "place" =
257 or
258 { raw.name.sort }
259 { name.sort }
260 if$
261 " "
262 *
263 #1 entry.max$ substring$
264 'sort.key$ :=
265 }
266
267 % ------------------------------------------------------------
268 % P R E - A N D P O S T - H E A D E R S
269 % ------------------------------------------------------------
270
271 FUNCTION {begin.bib}
272 { "<HTML>" write$
273 newline$
274 "<TITLE>Address Book</TITLE>" write$
275 newline$
276 }
277
278 FUNCTION {end.bib}
279 { newline$
280 "<p><hr><center><font size=-1>This address book was generated by <A HREF= " write$
281 quote$ "http://www.geuz.org/directory/" * quote$ * write$
282 " >directory</A></center></HTML>" write$
283 newline$
284 }
285
286 % ------------------------------------------------------------
287 % F O R M A T S
288 % ------------------------------------------------------------
289
290 FUNCTION {format.names}
291 { 's :=
292 #1 'nameptr :=
293 s num.names$ 'numnames :=
294 numnames 'namesleft :=
295 { namesleft #0 > }
296 {
297 % CUSTOM uncomment one of the following lines to have the behaviour on the right
298 s nameptr "{ff{ } }{vv{ } }{ll{ }}{, jj{ }}" format.name$ 't := % Christophe de Geuzaine, jr
299 % s nameptr "{f.{ } }{vv{ } }{ll{ }}{, jj{ }}" format.name$ 't := % C. de Geuzaine, jr
300 % s nameptr "{vv{ } }{ll{ }}{ f.{ }}{, jj{ }}" format.name$ 't := % de Geuzaine C., jr
301 % s nameptr "{vv{ } }{ll{ }}{, ff{ }}{, jj{ }}" format.name$ 't := % de Geuzaine, Christophe, jr
302
303 nameptr #1 >
304 { namesleft #1 >
305 { ", " * t * }
306 { and.str * t * }
307 if$
308 }
309 't
310 if$
311 nameptr #1 + 'nameptr :=
312 namesleft #1 - 'namesleft :=
313 }
314 while$
315 }
316
317
318 FUNCTION {format.dates}
319 {
320 's :=
321 #1 'nameptr :=
322 s num.names$ 'numnames :=
323 numnames 'namesleft :=
324
325 birthyear empty$
326 { #0 'numaux := }
327 { birthyear num.names$ 'numaux :=
328 numnames numaux =
329 { }
330 { " birthdays and birthyears don't match in entry '" cite$ * "'" * warning$ }
331 if$
332 }
333 if$
334
335 % CUSTOM
336
337 { namesleft #0 > }
338 { s nameptr "{ff}" format.name$ 't :=
339 s nameptr "{ll}" format.name$ 'u :=
340
341 nameptr #1 >
342 { namesleft #1 >
343 { ", " * t * "/" * u * }
344 { and.str * t * "/" * u * }
345 if$
346 }
347 { t "/" * u * }
348 if$
349
350 numaux #0 > not
351 { }
352 { birthyear nameptr "{ll}" format.name$ 'v :=
353 "/" * v * }
354 if$
355
356 nameptr #1 + 'nameptr :=
357 namesleft #1 - 'namesleft :=
358 numaux #1 - 'numaux :=
359 }
360 while$
361 }
362
363 FUNCTION {format.years}
364 {
365 's :=
366 #1 'nameptr :=
367 s num.names$ 'numnames :=
368 numnames 'namesleft :=
369
370 { namesleft #0 > }
371 { s nameptr "{ll}" format.name$ 't :=
372 nameptr #1 >
373 { namesleft #1 >
374 { ", " * t * }
375 { and.str * t * }
376 if$
377 }
378 t
379 if$
380 nameptr #1 + 'nameptr :=
381 namesleft #1 - 'namesleft :=
382 }
383 while$
384 }
385
386 FUNCTION {format.name}
387 { name empty$
388 { "" }
389 { name format.names }
390 if$
391 }
392
393 FUNCTION {format.nickname}
394 { nickname empty$
395 { "" }
396 { nickname.str nickname format.names * }
397 if$
398 }
399
400 FUNCTION {format.birthday.flag}
401 { birthyear empty$ not
402 birthday empty$ not
403 or
404 { birthday.str }
405 { "" }
406 if$
407 }
408
409 FUNCTION {format.birthday}
410 { birthday empty$
411 {
412 birthyear empty$
413 { "" }
414 { birthyear format.years }
415 if$
416 }
417 { birthday format.dates }
418 if$
419 }
420
421 FUNCTION {format.address}
422 { address empty$
423 {
424 street empty$ city empty$ state empty$ zip empty$ country empty$
425 and and and and
426 { "" }
427 { address.str
428 street empty$ { "" * } { street " " * * } if$
429 city empty$ { "" * } { city " " * * } if$
430 state empty$ { "" * } { state " " * * } if$
431 zip empty$ { "" * } { zip " " * * } if$
432 country empty$ { "" * } { country * } if$
433 }
434 if$
435 }
436 { address.str address * }
437 if$
438 }
439
440 FUNCTION {format.account}
441 { account empty$
442 { "" }
443 { account.str account ttize * }
444 if$
445 }
446
447 FUNCTION {format.phone}
448 { phone empty$
449 { "" }
450 { phone.str phone * }
451 if$
452 }
453
454 FUNCTION {format.cellular}
455 { cellular empty$
456 { "" }
457 { cellular.str cellular * }
458 if$
459 }
460
461 FUNCTION {format.fax}
462 { fax empty$
463 { "" }
464 { fax.str fax * }
465 if$
466 }
467
468 FUNCTION {format.email}
469 { email empty$
470 { "" }
471 { email.str email email emailize * }
472 if$
473 }
474
475 FUNCTION {format.url}
476 { url empty$
477 { "" }
478 { url.str url url urlize * }
479 if$
480 }
481
482
483 FUNCTION {format.p.flag}
484 { p.address empty$ not
485 p.street empty$ not
486 p.city empty$ not
487 p.state empty$ not
488 p.zip empty$ not
489 p.country empty$ not
490 p.phone empty$ not
491 p.cellular empty$ not
492 p.fax empty$ not
493 p.email empty$ not
494 p.url empty$ not
495 p.account empty$ not
496 or or or or or or or or or or or
497 { private.str }
498 { "" }
499 if$
500 }
501
502 FUNCTION {format.p.address}
503 { p.address empty$
504 {
505 p.street empty$ p.city empty$ p.state empty$ p.zip empty$ p.country empty$
506 and and and and
507 { "" }
508 { address.str
509 p.street empty$ { "" * } { p.street " " * * } if$
510 p.city empty$ { "" * } { p.city " " * * } if$
511 p.state empty$ { "" * } { p.state " " * * } if$
512 p.zip empty$ { "" * } { p.zip " " * * } if$
513 p.country empty$ { "" * } { p.country * } if$
514 }
515 if$
516 }
517 { address.str p.address * }
518 if$
519 }
520
521 FUNCTION {format.p.phone}
522 { p.phone empty$
523 { "" }
524 { phone.str p.phone * }
525 if$
526 }
527
528 FUNCTION {format.p.cellular}
529 { p.cellular empty$
530 { "" }
531 { cellular.str p.cellular * }
532 if$
533 }
534
535 FUNCTION {format.p.fax}
536 { p.fax empty$
537 { "" }
538 { fax.str p.fax * }
539 if$
540 }
541
542 FUNCTION {format.p.email}
543 { p.email empty$
544 { "" }
545 { email.str p.email p.email emailize * }
546 if$
547 }
548
549 FUNCTION {format.p.url}
550 { p.url empty$
551 { "" }
552 { url.str p.url p.url urlize * }
553 if$
554 }
555
556 FUNCTION {format.p.account}
557 { p.account empty$
558 { "" }
559 { account.str p.account ttize * }
560 if$
561 }
562
563 FUNCTION {format.r.flag}
564 { r.address empty$ not
565 r.street empty$ not
566 r.city empty$ not
567 r.state empty$ not
568 r.zip empty$ not
569 r.country empty$ not
570 r.phone empty$ not
571 r.cellular empty$ not
572 r.fax empty$ not
573 r.email empty$ not
574 r.url empty$ not
575 r.account empty$ not
576 or or or or or or or or or or or
577 { residence.str }
578 { "" }
579 if$
580 }
581
582 FUNCTION {format.r.address}
583 { r.address empty$
584 {
585 r.street empty$ r.city empty$ r.state empty$ r.zip empty$ r.country empty$
586 and and and and
587 { "" }
588 { address.str
589 r.street empty$ { "" * } { r.street " " * * } if$
590 r.city empty$ { "" * } { r.city " " * * } if$
591 r.state empty$ { "" * } { r.state " " * * } if$
592 r.zip empty$ { "" * } { r.zip " " * * } if$
593 r.country empty$ { "" * } { r.country * } if$
594 }
595 if$
596 }
597 { address.str r.address * }
598 if$
599 }
600
601 FUNCTION {format.r.phone}
602 { r.phone empty$
603 { "" }
604 { phone.str r.phone * }
605 if$
606 }
607
608 FUNCTION {format.r.cellular}
609 { r.cellular empty$
610 { "" }
611 { cellular.str r.cellular * }
612 if$
613 }
614
615 FUNCTION {format.r.fax}
616 { r.fax empty$
617 { "" }
618 { fax.str r.fax * }
619 if$
620 }
621
622 FUNCTION {format.r.email}
623 { r.email empty$
624 { "" }
625 { email.str r.email r.email emailize * }
626 if$
627 }
628
629 FUNCTION {format.r.url}
630 { r.url empty$
631 { "" }
632 { url.str r.url r.url urlize * }
633 if$
634 }
635
636 FUNCTION {format.r.account}
637 { r.account empty$
638 { "" }
639 { account.str r.account ttize * }
640 if$
641 }
642
643 FUNCTION {format.w.flag}
644 { w.title empty$ not
645 w.name empty$ not
646 w.address empty$ not
647 w.street empty$ not
648 w.city empty$ not
649 w.state empty$ not
650 w.zip empty$ not
651 w.country empty$ not
652 w.phone empty$ not
653 w.cellular empty$ not
654 w.fax empty$ not
655 w.email empty$ not
656 w.url empty$ not
657 w.account empty$ not
658 or or or or or or or or or or or or or
659 { work.str }
660 { "" }
661 if$
662 }
663
664 FUNCTION {format.w.title}
665 { w.title empty$
666 { "" }
667 { title.str w.title * }
668 if$
669 }
670
671 FUNCTION {format.w.name}
672 { w.name empty$
673 { "" }
674 { name.str w.name * }
675 if$
676 }
677
678 FUNCTION {format.w.address}
679 { w.address empty$
680 {
681 w.street empty$ w.city empty$ w.state empty$ w.zip empty$ w.country empty$
682 and and and and
683 { "" }
684 { address.str
685 w.street empty$ { "" * } { w.street " " * * } if$
686 w.city empty$ { "" * } { w.city " " * * } if$
687 w.state empty$ { "" * } { w.state " " * * } if$
688 w.zip empty$ { "" * } { w.zip " " * * } if$
689 w.country empty$ { "" * } { w.country * } if$
690 }
691 if$
692 }
693 { address.str w.address * }
694 if$
695 }
696
697 FUNCTION {format.w.phone}
698 { w.phone empty$
699 { "" }
700 { phone.str w.phone * }
701 if$
702 }
703
704 FUNCTION {format.w.cellular}
705 { w.cellular empty$
706 { "" }
707 { cellular.str w.cellular * }
708 if$
709 }
710
711 FUNCTION {format.w.fax}
712 { w.fax empty$
713 { "" }
714 { fax.str w.fax * }
715 if$
716 }
717
718 FUNCTION {format.w.email}
719 { w.email empty$
720 { "" }
721 { email.str w.email w.email emailize * }
722 if$
723 }
724
725 FUNCTION {format.w.url}
726 { w.url empty$
727 { "" }
728 { url.str w.url w.url urlize * }
729 if$
730 }
731
732 FUNCTION {format.w.account}
733 { w.account empty$
734 { "" }
735 { account.str w.account ttize * }
736 if$
737 }
738
739 FUNCTION {format.note.flag}
740 { note empty$
741 { "" }
742 { note.str }
743 if$
744 }
745
746 FUNCTION {format.note}
747 { note empty$
748 { "" }
749 { note }
750 if$
751 }
752
753
754 % ------------------------------------------------------------
755 % P E R S O N E N T R Y
756 % ------------------------------------------------------------
757
758 FUNCTION { person }
759 {
760 init.strings
761 newline$
762 "<p><dt><b>" write$
763 format.name write$
764 "</b></dt>" write$
765
766 format.nickname write$
767
768 ""
769 format.birthday.flag output
770 format.birthday output
771
772 format.p.flag output
773 format.p.address output
774 format.p.phone output
775 format.p.cellular output
776 format.p.fax output
777 format.p.email output
778 format.p.url output
779 format.p.account output
780
781 format.r.flag output
782 format.r.address output
783 format.r.phone output
784 format.r.cellular output
785 format.r.fax output
786 format.r.email output
787 format.r.url output
788 format.r.account output
789
790 format.w.flag output
791 format.w.title output
792 format.w.name output
793 format.w.address output
794 format.w.phone output
795 format.w.cellular output
796 format.w.fax output
797 format.w.email output
798 format.w.url output
799 format.w.account output
800
801 format.note.flag output
802 format.note output
803
804 write$
805 newline$
806 }
807
808 % ------------------------------------------------------------
809 % C O M P A N Y E N T R Y
810 % ------------------------------------------------------------
811
812
813 FUNCTION { company }
814 {
815 init.strings
816 newline$
817 "<p><dt><b>" write$
818 name write$
819 "</b></dt><dd>" write$
820
821 ""
822 format.address output
823 format.phone output
824 format.cellular output
825 format.fax output
826 format.email output
827 format.url output
828 format.account output
829 format.note.flag output
830 format.note output
831
832 write$
833 newline$
834 }
835
836 % ------------------------------------------------------------
837 % P L A C E E N T R Y
838 % ------------------------------------------------------------
839
840 FUNCTION { place }
841 {
842 init.strings
843 newline$
844 "<p><dt><b>" write$
845 name write$
846 "</b></dt><dd>" write$
847
848 ""
849 format.address output
850 format.phone output
851 format.cellular output
852 format.fax output
853 format.note.flag output
854 format.note output
855
856 write$
857 newline$
858 }
859
860 % ------------------------------------------------------------
861 % M A I N
862 % ------------------------------------------------------------
863
864 READ
865 ITERATE {presort}
866 SORT
867 EXECUTE {begin.bib}
868 ITERATE {call.type$}
869 EXECUTE {end.bib}
870