Initializes project with GEDCOM to Markdown converter

Sets up core functionality for converting genealogy GEDCOM files to Obsidian markdown notes

Implements key components:
- GEDCOM parsing and individual data extraction
- Markdown note generation with rich metadata
- Index file creation
- Comprehensive test suite for robust functionality

Adds initial project structure, configuration, and essential modules for genealogy data conversion
This commit is contained in:
AlexKucera committed 2025-11-01 14:20:53 +01:00
1 parent 24ebaea8d9
commit 3e7dc7e916
14 files changed
+2313 -275

No files matched your search

+9 -11
View File
@@ -22,7 +22,7 @@ class IndexGenerator:
The index is organized alphabetically by last name, then first name.
"""
def __init__(self, output_dir: Path, people_subdir: str = ''):
def __init__(self, output_dir: Path, people_subdir: str = ""):
"""
Initialize the index generator.
@@ -34,9 +34,7 @@ class IndexGenerator:
self.people_subdir = people_subdir
def generate_index(
self,
individuals: List[Individual],
index_filename: str = 'Index.md'
self, individuals: List[Individual], index_filename: str = "Index.md"
) -> Path:
"""
Generate an alphabetical index of all individuals.
@@ -55,15 +53,15 @@ class IndexGenerator:
# Sort individuals by last name, then first name
sorted_individuals = sorted(
individuals,
key=lambda i: (i.get_names()[1].lower(), i.get_names()[0].lower())
key=lambda i: (i.get_names()[1].lower(), i.get_names()[0].lower()),
)
with open(index_path, 'w', encoding='utf-8') as f:
with open(index_path, "w", encoding="utf-8") as f:
f.write("# Family Tree Index\n\n")
f.write(f"Total individuals: {len(individuals)}\n\n")
# Group by last name initial
current_letter = ''
current_letter = ""
for individual in sorted_individuals:
first, last = individual.get_names()
@@ -72,7 +70,7 @@ class IndexGenerator:
if last:
letter = last[0].upper()
else:
letter = '#' # For individuals without last name
letter = "#" # For individuals without last name
if letter != current_letter:
current_letter = letter
@@ -84,11 +82,11 @@ class IndexGenerator:
death_info = individual.get_death_info()
# Format life span
if birth_info['year'] or death_info['date']:
death_year = death_info['date'][:4] if death_info['date'] else ''
if birth_info["year"] or death_info["date"]:
death_year = death_info["date"][:4] if death_info["date"] else ""
life_span = f" ({birth_info['year']}-{death_year})"
else:
life_span = ''
life_span = ""
# Create WikiLink with path prefix if using subdirectories
if self.people_subdir: