-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add ascom author style #1221
add ascom author style #1221
Conversation
63f703c
to
da62560
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion for significantly simplifying the logic to remove the if statements that solely change the order of author and affiliation in the fomat method.
bin/db2authors.py
Outdated
@@ -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": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do elif args.mode == "ascom":
here so it wouldn't indent further.
bin/db2authors.py
Outdated
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code could be simplified a lot if we put key names in the format strings and then used kwargs with format
. eg
>>> f = "affiliation: {affil} author: {author}"
>>> f.format(author="Wil", affil="Rubin")
'affiliation: Rubin author: Wil'
Then you wouldn't need to have the if statement here or earlier because the order in the format
method wouldn't matter anyhow.
No description provided.