Skip to content

Commit

Permalink
add ascom author style
Browse files Browse the repository at this point in the history
  • Loading branch information
womullan committed Aug 30, 2024
1 parent bf855c1 commit da62560
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bin/db2authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# this should probably be a dict with the value of affil_cmd
# the keys could then be passed to the arg parser.
OUTPUT_MODES = ["aas", "spie", "adass", "arxiv"]
OUTPUT_MODES = ["aas", "spie", "adass", "arxiv", "ascom"]

description = __doc__
formatter = argparse.RawDescriptionHelpFormatter
Expand Down Expand Up @@ -87,6 +87,10 @@
buffer_authors = True
author_super = True

if args.mode == "ascom":
buffer_affil = True
affil_out_sep = ", "

with open(authorfile) as fh:
authors = yaml.safe_load(fh)

Expand Down Expand Up @@ -178,7 +182,10 @@ def get_initials(initials):
if args.noafil:
affilAuth = affilAuth
else:
affilAuth = auth_afil_form.format(affilAuth, affilSep, str(affilInd))
if args.mode == "ascom":
affilAuth = auth_afil_form.format(str(affilInd), affilAuth, affilSep)
else:
affilAuth = auth_afil_form.format(affilAuth, affilSep, str(affilInd))

affilSep = " "

Expand All @@ -191,6 +198,7 @@ def get_initials(initials):
orc = auth.get("orcid", "")
if orc is None:
orc = ""

email = auth.get("email", "")
if email is None:
email = ""
Expand Down Expand Up @@ -235,7 +243,10 @@ def get_initials(initials):
indexOutput.append(rf"%\aindex{{{surname},{justInitials}}}")

if buffer_authors:
authOutput.append(author_form.format(initials, surname, affilAuth))
if args.mode == "ascom":
authOutput.append(author_form.format(affilAuth, initials, surname))
else:
authOutput.append(author_form.format(initials, surname, affilAuth))
allAffil = allAffil + affilOutput
else:
print(author_form.format(orcid, initials, surname))
Expand Down

0 comments on commit da62560

Please sign in to comment.