Skip to content

Commit

Permalink
fix(album-search): 🐛 remove qutotations around author name when short…
Browse files Browse the repository at this point in the history
…ening to initials

fixes #67
  • Loading branch information
djdembeck committed Feb 23, 2023
1 parent 0645c16 commit 1fc755b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Contents/Code/search_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,18 @@ def check_if_preorder(self, book_date):
def name_to_initials(self, input_name):
"""
Converts a name to initials.
Shorten input_name by splitting on whitespaces
Only the surname stays as whole, the rest gets truncated
and merged with dots.
Example: 'Arthur Conan Doyle' -> 'A.C.Doyle'
Example: 'J K Rowling' -> 'J.K.Rowling'
Example: 'J. R. R. Tolkien' -> 'J.R.R.Tolkien'
"""
# Shorten input_name by splitting on whitespaces
# Only the surname stays as whole, the rest gets truncated
# and merged with dots.

# Remove quotation marks
input_name = input_name.replace('"', '')

# Split name into parts
name_parts = self.clear_contributor_text(input_name).split()

# Check if prename and surname exist, otherwise exit
Expand Down

0 comments on commit 1fc755b

Please sign in to comment.