Skip to content

Commit

Permalink
Reverse name order when building author list (#206)
Browse files Browse the repository at this point in the history
* Reverse name order when building author list

* Oops put the previous fix back in
  • Loading branch information
brian-rose authored Jun 6, 2024
1 parent 94aba6a commit fec19d9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion site/_extensions/gallery_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def _run_cffconvert(command):
error_message = stderr.decode("utf-8").strip()
raise RuntimeError(f"cffconvert command failed: {error_message}")

def _make_standard_name(name):
'''Take string input like LASTNAME, FIRSTNAME and return FIRSTNAME LASTNAME without comma'''
lastfirst = name.split(', ')
firstlast = lastfirst[::-1]
standard = ' '.join(firstlast)
return standard

def generate_repo_dicts(all_items):

Expand All @@ -60,7 +66,7 @@ def generate_repo_dicts(all_items):
cookbook_title = citation_dict["title"]
description = citation_dict["description"]
creators = citation_dict["creators"]
names = [creator.get("name") for creator in creators]
names = [_make_standard_name(creator.get("name")) for creator in creators]
authors = ", ".join(names)

gallery_info_url = f"https://raw.githubusercontent.com/ProjectPythia/{repo}/main/_gallery_info.yml"
Expand Down

0 comments on commit fec19d9

Please sign in to comment.