joeyaurel / python-gedcom

Python module for parsing, analyzing, and manipulating GEDCOM files
https://gedcom.joeyaurel.dev
GNU General Public License v2.0
152 stars 38 forks source link

[Feature request] documentation/example for print_gedcom and save_gedcom #59

Open dianekaplan opened 3 years ago

dianekaplan commented 3 years ago

Is your feature request related to a problem? Please describe. I'm SO HAPPY to have found gedcom.parser! I'm making a family tree in Django with the idea of having a gedcom file be the source of truth, so I can periodically re-import the updated file to my family tree and to the other programs where I have trees. This has been great for parsing, so that part is all set. But in order for my master plan to work, I have a script to generate unique ids for each person and I want to also be able to write out an updated gedcom file with the unique ids added in one of the tags (maybe @ALIA@ maybe something else).

I'm starting to play around with print_gedcom and save_gedcom and it sounds like they only take one argument (self)- and I'm not getting it to output successfully yet. Do you have a usage example?

Describe the solution you'd like A usage example added to documentation for print_gedcom and save_gedcom.

Describe alternatives you've considered So far I'm just trying things :)

gareth-lloyd commented 3 years ago

I expect I'm too late to be of much use to you, but I've just been playing around with this library and hit the same problem.

It's broken on version v1.0.0, but installing v2.0.0-dev3 fixed the issue.

The relevant change was in the code of gedcom/element/element.py, in the to_gedcom_string method of the Element class. Instead of returning early if the "level" of the node was less than 0 (which is true for the root node), the updated code carries on and outputs recusively.