Debian Codegraph @

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

raw
1 %% address-vcard.bst
2 %% Copyright 2003-2004 Christophe Geuzaine <[email protected]>
3 %
4 % $Id: address-vcard.bst,v 1.9 2004/01/10 06:45:16 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-vcard.bst'
12 % 'directory' database: all fields
13 %
14 % This is definitively a hack... It assumes the character encoding to
15 % be ISO Latin 1. Multi-name entries are not treated entirely
16 % correctly due to limitations in the vCard spec.
17 %
18 % Also, bibtex splits lines automatically in the output file, which
19 % can cause alignment problems (and apparently encoding problems with
20 % Apple's address book application). You can e.g. fix bibtex's output
21 % with awk:
22 %
23 % awk "!/^ /{ buf[i++] = $0; }
24 % /^ /{ buf[i-1] = buf[i-1] substr($0,2,length($0)-1) }
25 % END{ for(j=0;j<i;j++) print buf[j] }" file.bbl
26
27 INTEGERS { nameptr namesleft numnames numaux len }
28 STRINGS { s t u v }
29
30 % ------------------------------------------------------------
31 % E N T R I E S
32 % ------------------------------------------------------------
33
34 ENTRY
35 { name
36 nickname
37 birthday
38 birthyear
39 address % if empty, use street, city, ...
40 street
41 city
42 state
43 zip
44 country
45 phone
46 cellular
47 fax
48 email
49 url
50 account
51 p.address % if empty, use p.street, p.city, ...
52 p.street
53 p.city
54 p.state
55 p.zip
56 p.country
57 p.phone
58 p.cellular
59 p.fax
60 p.email
61 p.url
62 p.account
63 r.address % if empty, use r.street, r.city, ...
64 r.street
65 r.city
66 r.state
67 r.zip
68 r.country
69 r.phone
70 r.cellular
71 r.fax
72 r.email
73 r.url
74 r.account
75 w.title
76 w.name
77 w.address % if empty, use w.street, w.city, ...
78 w.street
79 w.city
80 w.state
81 w.zip
82 w.country
83 w.phone
84 w.cellular
85 w.fax
86 w.email
87 w.url
88 w.account
89 note
90 }
91 {}
92 {
93 }
94
95 % ------------------------------------------------------------
96 % G E N E R A L
97 % ------------------------------------------------------------
98
99 FUNCTION {output}
100 { 's :=
101 s empty$
102 {}
103 { s write$
104 newline$
105 }
106 if$
107 }
108
109 FUNCTION {not}
110 { { #0 }
111 { #1 }
112 if$
113 }
114
115 FUNCTION {and}
116 { 'skip$
117 { pop$ #0 }
118 if$
119 }
120
121 FUNCTION {or}
122 { { pop$ #1 }
123 'skip$
124 if$
125 }
126
127 % ------------------------------------------------------------
128 % P R E - A N D P O S T - H E A D E R S
129 % ------------------------------------------------------------
130
131 FUNCTION {begin.bib}
132 {
133 }
134
135 FUNCTION {end.bib}
136 {
137 }
138
139 % ------------------------------------------------------------
140 % G E N E R A L F O R M A T T I N G F U N C T I O N S
141 % ------------------------------------------------------------
142
143 FUNCTION {format.names}
144 { 's :=
145 #1 'nameptr :=
146 s num.names$ 'numnames :=
147 numnames 'namesleft :=
148 { namesleft #0 > }
149 {
150 % "Clinton; Bill (with Hillary Rodham, Chelsee and Christophe Geuzaine)"
151 nameptr #1 >
152 { s nameptr "{ff }{vv }{ll}{\, jj}" format.name$ 't := }
153 { s nameptr "{vv{ } }{ll{ }}{;ff{ }}{\, jj{ }}" format.name$ 't := }
154 if$
155 nameptr #1 >
156 {
157 nameptr #2 =
158 { " (with " * t * }
159 {
160 namesleft #1 >
161 { ", " * t * }
162 { " and " * t * }
163 if$
164 }
165 if$
166 namesleft #1 =
167 { ")" * }
168 { }
169 if$
170 }
171 't
172 if$
173 nameptr #1 + 'nameptr :=
174 namesleft #1 - 'namesleft :=
175 }
176 while$
177 }
178
179 FUNCTION {format.dates}
180 {
181 's :=
182 #1 'nameptr :=
183 s num.names$ 'numnames :=
184 numnames 'namesleft :=
185
186 birthyear empty$
187 { #0 'numaux := }
188 { birthyear num.names$ 'numaux :=
189 numnames numaux =
190 { }
191 { " birthdays and birthyears don't match in entry '" cite$ * "'" * warning$ }
192 if$
193 }
194 if$
195
196 { namesleft #0 > }
197 { s nameptr "{ff}" format.name$ 't :=
198 s nameptr "{ll}" format.name$ 'u :=
199
200 numaux #0 > not
201 { }
202 { birthyear nameptr "{ll}" format.name$ 'v :=
203 v * "-" * }
204 if$
205
206 nameptr #1 >
207 { ";" * u * "-" * t * }
208 { u "-" * t * }
209 if$
210
211 nameptr #1 + 'nameptr :=
212 namesleft #1 - 'namesleft :=
213 numaux #1 - 'numaux :=
214 }
215 while$
216 }
217
218 % ------------------------------------------------------------
219 % V C A R D F I E L D F O R M A T S
220 % ------------------------------------------------------------
221
222 FUNCTION {format.name}
223 { name empty$
224 { "" }
225 { "N;charset=iso-8859-1:" name format.names * }
226 if$
227 }
228
229 FUNCTION {format.simple.name}
230 { name empty$
231 { "" }
232 { "N;charset=iso-8859-1:" name ";" * * }
233 if$
234 }
235
236 FUNCTION {format.nickname}
237 { nickname empty$
238 { "" }
239 { "NICKNAME;charset=iso-8859-1:" nickname * }
240 if$
241 }
242
243 FUNCTION {format.birthday}
244 { birthday empty$
245 {
246 birthyear empty$
247 { "" }
248 { "BDAY;value=date:" birthyear * }
249 if$
250 }
251 { "BDAY;value=date:" birthday format.dates * }
252 if$
253 }
254
255 FUNCTION {format.address}
256 { address empty$
257 {
258 street empty$ city empty$ state empty$ zip empty$ country empty$
259 and and and and
260 { "" }
261 { "ADR;type=WORK;charset=iso-8859-1:;;"
262 street empty$ { "" } { street } if$ * ";" *
263 city empty$ { "" } { city } if$ * ";" *
264 state empty$ { "" } { state } if$ * ";" *
265 zip empty$ { "" } { zip } if$ * ";" *
266 country empty$ { "" } { country } if$ *
267 }
268 if$
269 }
270 { "ADR;type=WORK;charset=iso-8859-1:;;" address * ";;;;" * }
271 if$
272 }
273
274 FUNCTION {format.account}
275 { account empty$
276 { "" }
277 { "ACCOUNT:" account * }
278 if$
279 }
280
281 FUNCTION {format.phone}
282 { phone empty$
283 { "" }
284 { "TEL;type=WORK:" phone * }
285 if$
286 }
287
288 FUNCTION {format.cellular}
289 { cellular empty$
290 { "" }
291 { "TEL;type=CELL:" cellular * }
292 if$
293 }
294
295 FUNCTION {format.fax}
296 { fax empty$
297 { "" }
298 { "TEL;type=FAX:" fax * }
299 if$
300 }
301
302 FUNCTION {format.email}
303 { email empty$
304 { "" }
305 { "EMAIL:" email * }
306 if$
307 }
308
309 FUNCTION {format.url}
310 { url empty$
311 { "" }
312 { "URL:" url * }
313 if$
314 }
315
316 FUNCTION {format.p.address}
317 { p.address empty$
318 {
319 p.street empty$ p.city empty$ p.state empty$ p.zip empty$ p.country empty$
320 and and and and
321 { "" }
322 { "ADR;type=HOME;charset=iso-8859-1:;;"
323 p.street empty$ { "" } { p.street } if$ * ";" *
324 p.city empty$ { "" } { p.city } if$ * ";" *
325 p.state empty$ { "" } { p.state } if$ * ";" *
326 p.zip empty$ { "" } { p.zip } if$ * ";" *
327 p.country empty$ { "" } { p.country } if$ *
328 }
329 if$
330 }
331 { "ADR;type=HOME;charset=iso-8859-1:;;" p.address * ";;;;" * }
332 if$
333 }
334
335 FUNCTION {format.p.phone}
336 { p.phone empty$
337 { "" }
338 { "TEL;type=HOME:" p.phone * }
339 if$
340 }
341
342 FUNCTION {format.p.cellular}
343 { p.cellular empty$
344 { "" }
345 { "TEL;type=CELL:" p.cellular * }
346 if$
347 }
348
349 FUNCTION {format.p.fax}
350 { p.fax empty$
351 { "" }
352 { "TEL;type=FAX;type=HOME:" p.fax * }
353 if$
354 }
355
356 FUNCTION {format.p.email}
357 { p.email empty$
358 { "" }
359 { "EMAIL;type=HOME:" p.email * }
360 if$
361 }
362
363 FUNCTION {format.p.url}
364 { p.url empty$
365 { "" }
366 { "URL;type=HOME:" p.url * }
367 if$
368 }
369
370 FUNCTION {format.p.account}
371 { p.account empty$
372 { "" }
373 { "ACCOUNT;type=HOME:" p.account * }
374 if$
375 }
376
377 FUNCTION {format.r.address}
378 { r.address empty$
379 {
380 r.street empty$ r.city empty$ r.state empty$ r.zip empty$ r.country empty$
381 and and and and
382 { "" }
383 { "ADR;type=HOME;charset=iso-8859-1:;;"
384 r.street empty$ { "" } { r.street } if$ * ";" *
385 r.city empty$ { "" } { r.city } if$ * ";" *
386 r.state empty$ { "" } { r.state } if$ * ";" *
387 r.zip empty$ { "" } { r.zip } if$ * ";" *
388 r.country empty$ { "" } { r.country } if$ *
389 }
390 if$
391 }
392 { "ADR;type=HOME;charset=iso-8859-1:;;" r.address * ";;;;" * }
393 if$
394 }
395
396 FUNCTION {format.r.phone}
397 { r.phone empty$
398 { "" }
399 { "TEL;type=HOME:" r.phone * }
400 if$
401 }
402
403 FUNCTION {format.r.cellular}
404 { r.cellular empty$
405 { "" }
406 { "TEL;type=CELL:" r.cellular * }
407 if$
408 }
409
410 FUNCTION {format.r.fax}
411 { r.fax empty$
412 { "" }
413 { "TEL;type=FAX;type=HOME:" r.fax * }
414 if$
415 }
416
417 FUNCTION {format.r.email}
418 { r.email empty$
419 { "" }
420 { "EMAIL;type=HOME:" r.email * }
421 if$
422 }
423
424 FUNCTION {format.r.url}
425 { r.url empty$
426 { "" }
427 { "URL;type=HOME:" r.url * }
428 if$
429 }
430
431 FUNCTION {format.r.account}
432 { r.account empty$
433 { "" }
434 { "ACCOUNT;type=HOME:" r.account * }
435 if$
436 }
437
438 FUNCTION {format.w.title}
439 { w.title empty$
440 { "" }
441 { "TITLE;charset=iso-8859-1:" w.title * }
442 if$
443 }
444
445 FUNCTION {format.w.name}
446 { w.name empty$
447 { "" }
448 { "ORG;charset=iso-8859-1:" w.name * }
449 if$
450 }
451
452 FUNCTION {format.w.address}
453 { w.address empty$
454 {
455 w.street empty$ w.city empty$ w.state empty$ w.zip empty$ w.country empty$
456 and and and and
457 { "" }
458 { "ADR;type=WORK;charset=iso-8859-1:;;"
459 w.street empty$ { "" } { w.street } if$ * ";" *
460 w.city empty$ { "" } { w.city } if$ * ";" *
461 w.state empty$ { "" } { w.state } if$ * ";" *
462 w.zip empty$ { "" } { w.zip } if$ * ";" *
463 w.country empty$ { "" } { w.country } if$ *
464 }
465 if$
466 }
467 { "ADR;type=WORK;charset=iso-8859-1:;;" w.address * ";;;;" * }
468 if$
469 }
470
471 FUNCTION {format.w.phone}
472 { w.phone empty$
473 { "" }
474 { "TEL;type=WORK:" w.phone * }
475 if$
476 }
477
478 FUNCTION {format.w.cellular}
479 { w.cellular empty$
480 { "" }
481 { "TEL;type=CELL:" w.cellular * }
482 if$
483 }
484
485 FUNCTION {format.w.fax}
486 { w.fax empty$
487 { "" }
488 { "TEL;type=FAX;type=WORK:" w.fax * }
489 if$
490 }
491
492 FUNCTION {format.w.email}
493 { w.email empty$
494 { "" }
495 { "EMAIL;type=WORK:" w.email * }
496 if$
497 }
498
499 FUNCTION {format.w.url}
500 { w.url empty$
501 { "" }
502 { "URL;type=WORK:" w.url * }
503 if$
504 }
505
506 FUNCTION {format.w.account}
507 { w.account empty$
508 { "" }
509 { "ACCOUNT;type=WORK:" w.account * }
510 if$
511 }
512
513 FUNCTION {format.note}
514 { note empty$
515 { "" }
516 { "NOTE;charset=iso-8859-1:" note * }
517 if$
518 }
519
520 % ------------------------------------------------------------
521 % P E R S O N E N T R Y
522 % ------------------------------------------------------------
523
524 FUNCTION { person }
525 {
526 "BEGIN:VCARD" output
527 "VERSION:3.0" output
528
529 format.name output
530 format.nickname output
531 format.birthday output
532
533 format.p.address output
534 format.p.phone output
535 format.p.cellular output
536 format.p.fax output
537 format.p.email output
538 format.p.url output
539 format.p.account output
540
541 format.r.address output
542 format.r.phone output
543 format.r.cellular output
544 format.r.fax output
545 format.r.email output
546 format.r.url output
547 format.r.account output
548
549 format.w.title output
550 format.w.name output
551 format.w.address output
552 format.w.phone output
553 format.w.cellular output
554 format.w.fax output
555 format.w.email output
556 format.w.url output
557 format.w.account output
558
559 format.note output
560
561 "END:VCARD" output
562 }
563
564 % ------------------------------------------------------------
565 % C O M P A N Y E N T R Y
566 % ------------------------------------------------------------
567
568 FUNCTION { company }
569 {
570 "BEGIN:VCARD" output
571 "VERSION:3.0" output
572
573 format.simple.name output
574 format.address output
575 format.phone output
576 format.cellular output
577 format.fax output
578 format.email output
579 format.url output
580 format.account output
581 format.note output
582
583 "END:VCARD" output
584 }
585
586 % ------------------------------------------------------------
587 % P L A C E E N T R Y
588 % ------------------------------------------------------------
589
590 FUNCTION { place }
591 {
592 "BEGIN:VCARD" output
593 "VERSION:3.0" output
594
595 format.simple.name output
596 format.address output
597 format.phone output
598 format.cellular output
599 format.fax output
600 format.note output
601
602 "END:VCARD" output
603 }
604
605 % ------------------------------------------------------------
606 % M A I N
607 % ------------------------------------------------------------
608
609 READ
610 EXECUTE {begin.bib}
611 ITERATE {call.type$}
612 EXECUTE {end.bib}