%% email-html.bst
%% Copyright 1998-2003 Christophe Geuzaine
%
% $Id: email-html.bst,v 1.7 2004/02/07 23:41:45 geuzaine Exp $
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or (at your option) any later version.
%
% BibTeX bibliography style `addr-htm.bst'
% 'directory' database: all fields
%
% This is definitively a hack...
%
% The parts you may want to customize are labeled with "CUSTOM"
%
INTEGERS { nameptr namesleft numnames numaux len }
STRINGS { s t u v }
% ------------------------------------------------------------
% E N T R I E S
% ------------------------------------------------------------
ENTRY
{ name
email
p.email
r.email
w.email
}
{}
{ private.str
residence.str
work.str
and.str
}
% ------------------------------------------------------------
% G E N E R A L
% ------------------------------------------------------------
FUNCTION {init.strings}
{
% CUSOTM this is the 'html' equivalent for the \dirXXX customization
% commands
" priv." 'private.str :=
" temp." 'residence.str :=
" prof." 'work.str :=
" and " 'and.str :=
}
FUNCTION {output.nonnull}
{ 's :=
write$
newline$
s
}
FUNCTION {output}
{ duplicate$ empty$
'pop$
'output.nonnull
if$
}
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
FUNCTION {and}
{ 'skip$
{ pop$ #0 }
if$
}
FUNCTION {or}
{ { pop$ #1 }
'skip$
if$
}
FUNCTION {chop.word}
{ 's :=
'len :=
s #1 len substring$ =
{ s len #1 + global.max$ substring$ }
's
if$
}
FUNCTION {emailize}
{ duplicate$ empty$
{ pop$ "" }
{ "" * swap$ * "" * }
if$
}
% ------------------------------------------------------------
% S O R T I N G F U N C T I O N S
% ------------------------------------------------------------
FUNCTION {sortify}
{ purify$
"l" change.case$
}
FUNCTION {sort.names}
{ 's :=
#1 'nameptr :=
""
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ nameptr #1 >
{ " " * }
'skip$
if$
s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
nameptr numnames = t "others" = and
{ "et al" * }
{ t sortify * }
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
FUNCTION {sort.raw.names}
{ 't :=
"A " #2 "L'" #2
"An " #3 "Au " #3 "Le " #3 "La " #3
"The " #4 "Les " #4 "Aux " #4
t
chop.word chop.word
chop.word chop.word chop.word chop.word
chop.word chop.word chop.word
sortify
#1 global.max$ substring$
}
FUNCTION {name.sort}
{ name empty$
{ " Name field missing in entry '" cite$ * "'" * warning$ "" }
{ name sort.names }
if$
}
FUNCTION {raw.name.sort}
{ name empty$
{ " Name field missing in entry '" cite$ * "'" * warning$ "" }
{ name sort.raw.names }
if$
}
FUNCTION {presort}
{ type$ "company" =
type$ "place" =
or
{ raw.name.sort }
{ name.sort }
if$
" "
*
#1 entry.max$ substring$
'sort.key$ :=
}
% ------------------------------------------------------------
% P R E - A N D P O S T - H E A D E R S
% ------------------------------------------------------------
FUNCTION {begin.bib}
{ "" write$
newline$
"E-mail directory" write$
newline$
}
FUNCTION {end.bib}
{ newline$
"
This e-mail directory was generated by directory" write$
newline$
}
% ------------------------------------------------------------
% F O R M A T S
% ------------------------------------------------------------
FUNCTION {format.names}
{ 's :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{
% CUSTOM uncomment one of the following lines to have the behaviour on the right
% s nameptr "{ff{ } }{vv{ } }{ll{ }}{, jj{ }}" format.name$ 't := % Christophe de Geuzaine, jr
% s nameptr "{f.{ } }{vv{ } }{ll{ }}{, jj{ }}" format.name$ 't := % C. de Geuzaine, jr
% s nameptr "{vv{ } }{ll{ }}{ f.{ }}{, jj{ }}" format.name$ 't := % de Geuzaine C., jr
s nameptr "{vv{ } }{ll{ }}{, ff{ }}{, jj{ }}" format.name$ 't := % de Geuzaine, Christophe, jr
nameptr #1 >
{ namesleft #1 >
{ ", " * t * }
{ and.str * t * }
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
FUNCTION {format.name}
{ name empty$
{ "" }
{ name format.names }
if$
}
FUNCTION {format.email}
{ email empty$
{ "" }
{ email email emailize }
if$
}
FUNCTION {format.p.flag}
{ p.email empty$ not
{ private.str }
{ "" }
if$
}
FUNCTION {format.p.email}
{ p.email empty$
{ "" }
{ p.email p.email emailize }
if$
}
FUNCTION {format.r.flag}
{ r.email empty$ not
{ residence.str }
{ "" }
if$
}
FUNCTION {format.r.email}
{ r.email empty$
{ "" }
{ r.email r.email emailize }
if$
}
FUNCTION {format.w.flag}
{ w.email empty$ not
{ work.str }
{ "" }
if$
}
FUNCTION {format.w.email}
{ w.email empty$
{ "" }
{ w.email w.email emailize }
if$
}
% ------------------------------------------------------------
% P E R S O N E N T R Y
% ------------------------------------------------------------
FUNCTION { person }
{
p.email empty$ not
r.email empty$ not
w.email empty$ not
or or
{ init.strings
newline$
"
" write$
format.name write$
"" write$
""
format.p.flag output
format.p.email output
format.r.flag output
format.r.email output
format.w.flag output
format.w.email output
write$
newline$
}
{ }
if$
}
% ------------------------------------------------------------
% C O M P A N Y E N T R Y
% ------------------------------------------------------------
FUNCTION { company }
{
email empty$ not
{ init.strings
newline$
"
" write$
name write$
"" write$
""
format.email output
write$
newline$
}
{ }
if$
}
% ------------------------------------------------------------
% P L A C E E N T R Y
% ------------------------------------------------------------
FUNCTION { place }
{
}
% ------------------------------------------------------------
% M A I N
% ------------------------------------------------------------
READ
ITERATE {presort}
SORT
EXECUTE {begin.bib}
ITERATE {call.type$}
EXECUTE {end.bib}