2007-07-10 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_ReadXML.py (start_compound_date): Add new method; (start_datespan): Add new method. * data/grampsxml.dtd: Add datespan. * data/grampsxml.rng: Add datespan. * src/GrampsDb/_WriteXML.py (XmlWriter.write_date): Write the datespan. svn: r8711
This commit is contained in:
parent
dc185b12ac
commit
6575eede14
@ -1,3 +1,11 @@
|
||||
2007-07-10 Alex Roitman <shura@gramps-project.org>
|
||||
* src/GrampsDb/_ReadXML.py (start_compound_date): Add new method;
|
||||
(start_datespan): Add new method.
|
||||
* data/grampsxml.dtd: Add datespan.
|
||||
* data/grampsxml.rng: Add datespan.
|
||||
* src/GrampsDb/_WriteXML.py (XmlWriter.write_date): Write the
|
||||
datespan.
|
||||
|
||||
2007-07-05 Alex Roitman <shura@gramps-project.org>
|
||||
* configure.in: Require pygtk 2.8.0 or higher.
|
||||
|
||||
|
@ -109,7 +109,7 @@ GENDER has values of M, F, or U.
|
||||
<!ELEMENT gender (#PCDATA)>
|
||||
|
||||
<!ELEMENT name (first?,call?,last?,suffix?,patronymic?,title?,
|
||||
(daterange|dateval|datestr)?,note?,sourceref*)>
|
||||
(daterange|datespan|dateval|datestr)?,note?,sourceref*)>
|
||||
<!ATTLIST name
|
||||
alt (0|1) #IMPLIED
|
||||
type CDATA #IMPLIED
|
||||
@ -145,8 +145,8 @@ GENDER has values of M, F, or U.
|
||||
rel CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT address ((daterange|dateval|datestr)?,street?,city?,county?,state?,
|
||||
country?,postal?,phone?,note?,sourceref*)>
|
||||
<!ELEMENT address ((daterange|datespan|dateval|datestr)?,street?,city?,
|
||||
county?,state?,country?,postal?,phone?,note?,sourceref*)>
|
||||
<!ATTLIST address priv (0|1) #IMPLIED>
|
||||
|
||||
<!ELEMENT street (#PCDATA)>
|
||||
@ -199,7 +199,7 @@ EVENT
|
||||
-->
|
||||
<!ELEMENT events (event)*>
|
||||
|
||||
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
|
||||
<!ELEMENT event (type?,(daterange|datespan|dateval|datestr)?,place?,cause?,
|
||||
description?,attribute*,note?,sourceref*,objref*)>
|
||||
<!ATTLIST event
|
||||
id CDATA #REQUIRED
|
||||
@ -269,7 +269,7 @@ OBJECTS
|
||||
|
||||
<!ELEMENT objects (object)*>
|
||||
|
||||
<!ELEMENT object (file,attribute*,note?,(daterange|dateval|datestr)?,
|
||||
<!ELEMENT object (file,attribute*,note?,(daterange|datespan|dateval|datestr)?,
|
||||
sourceref*)>
|
||||
<!ATTLIST object
|
||||
id CDATA #REQUIRED
|
||||
@ -339,6 +339,14 @@ SHARED ELEMENTS
|
||||
cformat CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT datespan EMPTY>
|
||||
<!ATTLIST datespan
|
||||
start CDATA #REQUIRED
|
||||
stop CDATA #REQUIRED
|
||||
quality (estimated|calculated) #IMPLIED
|
||||
cformat CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT dateval EMPTY>
|
||||
<!ATTLIST dateval
|
||||
val CDATA #REQUIRED
|
||||
|
@ -257,6 +257,15 @@
|
||||
</choice></attribute></optional>
|
||||
<optional><attribute name="cformat"><text/></attribute></optional>
|
||||
</element>
|
||||
<element name="datespan">
|
||||
<attribute name="start"><text/></attribute>
|
||||
<attribute name="stop"><text/></attribute>
|
||||
<optional><attribute name="quality"><choice>
|
||||
<value>estimated</value>
|
||||
<value>calculated</value>
|
||||
</choice></attribute></optional>
|
||||
<optional><attribute name="cformat"><text/></attribute></optional>
|
||||
</element>
|
||||
<element name="dateval">
|
||||
<attribute name="val"><text/></attribute>
|
||||
<optional><attribute name="cformat"><text/></attribute></optional>
|
||||
|
@ -407,6 +407,7 @@ class GrampsParser(UpdateCallback):
|
||||
"place" : (self.start_place, self.stop_place),
|
||||
"dateval" : (self.start_dateval, None),
|
||||
"daterange" : (self.start_daterange, None),
|
||||
"datespan" : (self.start_datespan, None),
|
||||
"datestr" : (self.start_datestr, None),
|
||||
"places" : (None, self.stop_places),
|
||||
"placeobj" : (self.start_placeobj,self.stop_placeobj),
|
||||
@ -1274,6 +1275,12 @@ class GrampsParser(UpdateCallback):
|
||||
self.placeobj.add_media_reference(self.pref)
|
||||
|
||||
def start_daterange(self,attrs):
|
||||
self.start_compound_date(attrs,RelLib.Date.MOD_RANGE)
|
||||
|
||||
def start_datespan(self,attrs):
|
||||
self.start_compound_date(attrs,RelLib.Date.MOD_SPAN)
|
||||
|
||||
def start_compound_date(self,attrs,mode):
|
||||
if self.source_ref:
|
||||
dv = self.source_ref.get_date_object()
|
||||
elif self.ord:
|
||||
@ -1336,7 +1343,7 @@ class GrampsParser(UpdateCallback):
|
||||
else:
|
||||
qual = RelLib.Date.QUAL_NONE
|
||||
|
||||
dv.set(qual,RelLib.Date.MOD_RANGE,cal,(d,m,y,False,rd,rm,ry,False))
|
||||
dv.set(qual,mode,cal,(d,m,y,False,rd,rm,ry,False))
|
||||
|
||||
def start_dateval(self,attrs):
|
||||
if self.source_ref:
|
||||
|
@ -757,11 +757,17 @@ class XmlWriter(UpdateCallback):
|
||||
mode = date.get_modifier()
|
||||
|
||||
if date.is_compound():
|
||||
|
||||
if mode == RelLib.Date.MOD_RANGE:
|
||||
tagname = 'daterange'
|
||||
else:
|
||||
tagname = 'datespan'
|
||||
|
||||
d1 = self.get_iso_date(date.get_start_date())
|
||||
d2 = self.get_iso_date(date.get_stop_date())
|
||||
if d1 != "" or d2 != "":
|
||||
self.g.write('%s<daterange start="%s" stop="%s"%s%s/>\n'
|
||||
% (sp,d1,d2,qual_str,calstr))
|
||||
self.g.write('%s<%s start="%s" stop="%s"%s%s/>\n'
|
||||
% (sp,tagname,d1,d2,qual_str,calstr))
|
||||
elif mode != RelLib.Date.MOD_TEXTONLY:
|
||||
date_str = self.get_iso_date(date.get_start_date())
|
||||
if date_str == "":
|
||||
|
Loading…
Reference in New Issue
Block a user