From 9811ee65cbca8dd0ce2d9510828501409b1937f3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 2 Dec 2025 21:52:42 -0500 Subject: [PATCH] Add more info to interactive family tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Show lifespan (e.g., "930 yrs") when available - Show number of children - Add scripture reference link for each person - Make spouse names clickable links when they exist in data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../templates/family_tree_interactive.html | 96 +++++++++++++++++-- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/kjvstudy_org/templates/family_tree_interactive.html b/kjvstudy_org/templates/family_tree_interactive.html index bf63f1a..e499de4 100644 --- a/kjvstudy_org/templates/family_tree_interactive.html +++ b/kjvstudy_org/templates/family_tree_interactive.html @@ -188,6 +188,29 @@ font-style: italic; } +.person-spouse a { + color: #888; + text-decoration: none; +} + +.person-spouse a:hover { + text-decoration: underline; +} + +.person-verse { + font-size: 0.85rem; + color: #888; +} + +.person-verse a { + color: var(--link-color); + text-decoration: none; +} + +.person-verse a:hover { + text-decoration: underline; +} + .kekule-badge { display: inline-block; font-size: 0.75rem; @@ -416,20 +439,43 @@ function buildTreeHTML(personId, depth = 0, visited = new Set(), isRoot = false) // Meta info let meta = []; if (person.generation) meta.push(`Gen ${person.generation}`); - if (person.birth_year && person.birth_year !== 'Unknown') { - let dates = person.birth_year; - if (person.death_year && person.death_year !== 'Unknown') { - dates += '–' + person.death_year; - } - meta.push(dates); + + // Extract lifespan from death_year if it contains "Lived X years" + const lifespanMatch = person.death_year && person.death_year.match(/Lived (\d+) years/); + if (lifespanMatch) { + meta.push(`${lifespanMatch[1]} yrs`); } + + // Number of children + if (children.length > 0) { + meta.push(`${children.length} child${children.length > 1 ? 'ren' : ''}`); + } + if (meta.length > 0) { html += `(${meta.join(', ')})`; } - // Spouse + // Spouse (try to link if they exist in data) if (person.spouse) { - html += `∞ ${person.spouse}`; + const spouseId = findPersonId(person.spouse); + if (spouseId) { + html += `∞ ${person.spouse}`; + } else { + html += `∞ ${person.spouse}`; + } + } + + // Scripture reference + if (person.verses && person.verses.length > 0) { + const verse = person.verses[0]; + const refMatch = verse.reference.match(/^(\d?\s*[A-Za-z]+)\s+(\d+):(\d+)/); + if (refMatch) { + const book = refMatch[1].trim(); + const chapter = refMatch[2]; + const verseNum = refMatch[3]; + const verseUrl = `/book/${encodeURIComponent(book)}/chapter/${chapter}#verse-${verseNum}`; + html += `${verse.reference}`; + } } html += ''; @@ -479,12 +525,44 @@ function buildAncestorsHTML(personId, depth = 0, visited = new Set(), isRoot = f let meta = []; if (person.generation) meta.push(`Gen ${person.generation}`); + + // Extract lifespan from death_year if it contains "Lived X years" + const lifespanMatch = person.death_year && person.death_year.match(/Lived (\d+) years/); + if (lifespanMatch) { + meta.push(`${lifespanMatch[1]} yrs`); + } + + // Number of children (for ancestors view, show children count) + const children = person.children || []; + if (children.length > 0) { + meta.push(`${children.length} child${children.length > 1 ? 'ren' : ''}`); + } + if (meta.length > 0) { html += `(${meta.join(', ')})`; } + // Spouse (try to link if they exist in data) if (person.spouse) { - html += `∞ ${person.spouse}`; + const spouseId = findPersonId(person.spouse); + if (spouseId) { + html += `∞ ${person.spouse}`; + } else { + html += `∞ ${person.spouse}`; + } + } + + // Scripture reference + if (person.verses && person.verses.length > 0) { + const verse = person.verses[0]; + const refMatch = verse.reference.match(/^(\d?\s*[A-Za-z]+)\s+(\d+):(\d+)/); + if (refMatch) { + const book = refMatch[1].trim(); + const chapter = refMatch[2]; + const verseNum = refMatch[3]; + const verseUrl = `/book/${encodeURIComponent(book)}/chapter/${chapter}#verse-${verseNum}`; + html += `${verse.reference}`; + } } html += '';