Skip to content
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

Merged
merged 3 commits into from
Aug 30, 2024
Merged

add ascom author style #1221

merged 3 commits into from
Aug 30, 2024

Conversation

womullan
Copy link
Member

No description provided.

Copy link
Member

@timj timj left a 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.

@@ -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":
Copy link
Member

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.

@@ -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))
Copy link
Member

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.

@womullan womullan merged commit 1c253e2 into main Aug 30, 2024
9 checks passed
@womullan womullan deleted the tickets/DM-46066 branch August 30, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants