* src/DateParser.py: match modifiers in reverse length order so that

multiword modifiers work even if other modifier matches the first
words of the longer modifier
* src/ReadGedcom.py: be more tolerant w.r.t. whitespace in input,
to parse the output from tools that try (incorrectly) to make
the GEDCOM easier to read.  Gedcom.pm is one example.
* src/WriteGedcom.py: make sure referenced family sources are output


svn: r5444
This commit is contained in:
Julio Sánchez 2005-11-28 09:10:47 +00:00
parent 499aed0bd3
commit df1ba0e69c
4 changed files with 19 additions and 2 deletions

@ -1,3 +1,12 @@
2005-11-28 Julio Sanchez <jsanchez@users.sourceforge.net>
* src/DateParser.py: match modifiers in reverse length order so that
multiword modifiers work even if other modifier matches the first
words of the longer modifier
* src/ReadGedcom.py: be more tolerant w.r.t. whitespace in input,
to parse the output from tools that try (incorrectly) to make
the GEDCOM easier to read. Gedcom.pm is one example.
* src/WriteGedcom.py: make sure referenced family sources are output
2005-11-27 Don Allingham <don@gramps-project.org>
* src/MergeData.py: fix dangling family after a merge.

@ -241,8 +241,10 @@ class DateParser:
self._qual_str = '(' + '|'.join(
[ key.replace('.','\.') for key in self.quality_to_int.keys() ]
) + ')'
keys = self.modifier_to_int.keys()
keys.sort(lambda x, y: cmp(len(y), len(x)))
self._mod_str = '(' + '|'.join(
[ key.replace('.','\.') for key in self.modifier_to_int.keys() ]
[ key.replace('.','\.') for key in keys ]
) + ')'
self._mod_after_str = '(' + '|'.join(
[ key.replace('.','\.') for key in self.modifier_after_to_int.keys() ]

@ -140,6 +140,7 @@ snameRegexp= re.compile(r"/([^/]*)/([^/]*)")
calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$")
rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$")
spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$")
whitespaceRegexp = re.compile(r"\s+")
#-------------------------------------------------------------------------
#
@ -532,7 +533,7 @@ class GedcomParser:
self.text = string.translate(self.text,self.transtable2)
self.index += 1
l = self.text.split(' ', 2)
l = whitespaceRegexp.split(self.text, 2)
ln = len(l)
try:
if ln == 2:

@ -106,6 +106,11 @@ _get_int = re.compile('([0-9]+)')
#-------------------------------------------------------------------------
def add_familys_sources(db,family_handle,slist,private):
family = db.get_family_from_handle(family_handle)
for source_ref in family.get_source_references():
sbase = source_ref.get_base_handle()
if sbase != None and not slist.has_key(sbase):
slist[sbase] = 1
for event_handle in family.get_event_list():
if event_handle:
event = db.get_event_from_handle(event_handle)