feat: add source parsing and linking #8

Open
jaredhowland wants to merge 9 commits from jaredhowland/add-source-parsing into main
pull from: jaredhowland/add-source-parsing
9 Commits
Author SHA1 Message Date
copilot-swe-agent[bot]andjaredhowland c68264978d fix: apply code review feedback on CONT handling, retry guard, title escaping, lazy file open, and 4-space indent
Agent-Logs-Url: https://github.com/jaredhowland/gedcom-to-markdown/sessions/6c8ce2c8-7699-47a3-99f1-909cfa5ac7cd

Co-authored-by: jaredhowland <1877384+jaredhowland@users.noreply.github.com>
2026-04-18 04:07:32 +00:00
copilot-swe-agent[bot]andjaredhowland 676b4014ca chore: merge origin/combined-feat into add-source-parsing
Co-authored-by: jaredhowland <1877384+jaredhowland@users.noreply.github.com>
2026-04-18 04:00:50 +00:00
Jared Howland 96da61c1ff fix: implement suggestions of coderabbit and copilot
- Tighten exception handling when retrieving GEDCOM element dictionary; log failures and avoid repeated scans
 - Use shared resolve_gedcom_text() and collapse_single_line() helpers to remove duplication
 - Ensure inline NOTE continuations under INDI are resolved when NOTE has no immediate value (process CONT/CONC children)
 - Make sources index generation robust and streaming to avoid large memory use
 - Deterministic handling of last non-empty lines when writing note blocks

 - Expanded and clarified docstrings for GEDCOM resolver, collapse helper, and markdown generator helpers
2026-04-17 14:06:54 -06:00
Jared Howland 6259bfffd6 feat: add source parsing and linking
- Respect GEDCOM CONC vs CONT semantics (concatenate vs newline)
 - Generate global sources index once (avoid O(N*S) stall)
 - Repair broken HTML tags spanning GEDCOM lines for whitelist tags
 - Escape markdown emphasis characters in notes to prevent formatting leakage
 - Consistent handling of CONT/CONC; skip empty CONT lines; handle trailing spaces for hard breaks
 - Added tests covering CONT/CONC and source index
2026-04-17 13:42:04 -06:00
Jared Howland 1f48292e60 feat: add FamilySearch ID to frontmatter
Add get_fs_id() to Individual to extract the _FSFTID tag (returns empty string if missing). Update MarkdownGenerator to include a "FamilySearch ID" line in output when present. Update test fixtures and add assertions: include _FSFTID in sample GEDCOM, add unit test for get_fs_id (presence and absence), and check the generated markdown contains the FamilySearch ID. Ensures FS Tree IDs are surfaced without breaking behavior when tag is absent.
2026-04-16 23:47:53 -06:00
Jared Howland 2071c01317 fix: clarify parent GEDCOM pointer format
Update docstring in src/individual.py to specify that the `father` and `mother` fields are GEDCOM pointers including the surrounding '@' characters (e.g. '@I1@', '@I2@'), removing ambiguity about the expected identifier format.
2026-04-16 23:07:13 -06:00
Jared Howland 0ba00d0ef7 fix: lat/long extraction and emit coordinates
Rename returned long variable to lon and tighten lat/long extraction to avoid recursing into LATI/LONG leaf nodes and to return early when both values are found. Refactor MarkdownGenerator._coordinate_values and change output logic so coordinates are written even when place fields are empty (birth, death, marriage, and events). Update and reorganize tests to match the corrected behavior and improve stability (use next() instead of list indexing, consolidate fixtures, adjust assertions and quoting).
2026-04-16 23:02:49 -06:00
Jared Howland 747175fcef fix: cache subject pointer; tidy up tests
Cache the subject pointer in Individual.get_families by calling self.element.get_pointer() once outside the loop to avoid repeated calls and add a clarifying comment. Clean up tests: remove a duplicated TestIndividualBasicInfo fixture/block comment, drop redundant assertions about residence coordinates, and remove an unnecessary return in TestAttributes.
2026-04-16 22:51:45 -06:00
Jared Howland 2108325252 feat: extract place lat/long coordinates
* Show coordinates for any place that has them
* Add tests for coordinates
2026-04-16 22:16:34 -06:00