Fixes duplicate filename generation
Addresses an issue where duplicate filenames could be generated for individuals with the same name, especially in large datasets. This change introduces a mechanism to ensure unique filenames by appending a counter to duplicate names. It updates the index generator and markdown generator to use this mechanism, ensuring that links between individuals are correctly resolved.
This commit is contained in:
4 files changed
+68
-19
No files matched your search
+3
-8
@@ -78,18 +78,13 @@ class Individual:
|
||||
|
||||
def get_file_name(self) -> str:
|
||||
"""
|
||||
Build a filename-like string for the individual in the form "FamilyName FirstName" optionally followed by the birth year.
|
||||
Build a filename-like string for the individual in the form "FamilyName FirstName".
|
||||
|
||||
Returns:
|
||||
filename (str): The generated filename string, either "FamilyName FirstName BirthYear" or "FamilyName FirstName" when the birth year is not available; does not include a file extension; preserves original name capitalization.
|
||||
filename (str): The generated filename string "FamilyName FirstName"; does not include a file extension; preserves original name capitalization.
|
||||
"""
|
||||
first, last = self.get_names()
|
||||
name_part = f"{last} {first}".strip()
|
||||
|
||||
birth_year = self.element.get_birth_year()
|
||||
if birth_year != -1:
|
||||
return f"{name_part} {birth_year}"
|
||||
return name_part
|
||||
return f"{last} {first}".strip()
|
||||
|
||||
def get_birth_info(self) -> Dict[str, str]:
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user