2007-07-10 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsDbWriteXML.py (write_date): Write datespan. * src/GrampsDbUtils/_ReadXML.py: (start_compound_date): Add new method; (start_datespan): Add new method. * data/grampsxml.dtd: Add datespan. * data/grampsxml.rng: Add datespan. svn: r8712
This commit is contained in:
parent
b836a61cff
commit
5984415471
@ -1,3 +1,10 @@
|
|||||||
|
2007-07-10 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsDbWriteXML.py (write_date): Write datespan.
|
||||||
|
* src/GrampsDbUtils/_ReadXML.py: (start_compound_date): Add new
|
||||||
|
method; (start_datespan): Add new method.
|
||||||
|
* data/grampsxml.dtd: Add datespan.
|
||||||
|
* data/grampsxml.rng: Add datespan.
|
||||||
|
|
||||||
2007-07-08 Alex Roitman <shura@gramps-project.org>
|
2007-07-08 Alex Roitman <shura@gramps-project.org>
|
||||||
* configure.in: Add check for python-cairo>=1.2.6.
|
* configure.in: Add check for python-cairo>=1.2.6.
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ GENDER has values of M, F, or U.
|
|||||||
<!ELEMENT gender (#PCDATA)>
|
<!ELEMENT gender (#PCDATA)>
|
||||||
|
|
||||||
<!ELEMENT name (first?,call?,last?,suffix?,patronymic?,title?,
|
<!ELEMENT name (first?,call?,last?,suffix?,patronymic?,title?,
|
||||||
(daterange|dateval|datestr)?,noteref*,sourceref*)>
|
(daterange|datespan|dateval|datestr)?,noteref*,sourceref*)>
|
||||||
<!ATTLIST name
|
<!ATTLIST name
|
||||||
alt (0|1) #IMPLIED
|
alt (0|1) #IMPLIED
|
||||||
type CDATA #IMPLIED
|
type CDATA #IMPLIED
|
||||||
@ -147,8 +147,8 @@ GENDER has values of M, F, or U.
|
|||||||
rel CDATA #REQUIRED
|
rel CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT address ((daterange|dateval|datestr)?,street?,city?,county?,state?,
|
<!ELEMENT address ((daterange|datespan|dateval|datestr)?,street?,city?,
|
||||||
country?,postal?,phone?,noteref*,sourceref*)>
|
county?,state?,country?,postal?,phone?,noteref*,sourceref*)>
|
||||||
<!ATTLIST address priv (0|1) #IMPLIED>
|
<!ATTLIST address priv (0|1) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT street (#PCDATA)>
|
<!ELEMENT street (#PCDATA)>
|
||||||
@ -201,7 +201,7 @@ EVENT
|
|||||||
-->
|
-->
|
||||||
<!ELEMENT events (event)*>
|
<!ELEMENT events (event)*>
|
||||||
|
|
||||||
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
|
<!ELEMENT event (type?,(daterange|datespan|dateval|datestr)?,place?,cause?,
|
||||||
description?,attribute*,noteref*,sourceref*,objref*)>
|
description?,attribute*,noteref*,sourceref*,objref*)>
|
||||||
<!ATTLIST event
|
<!ATTLIST event
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
@ -271,8 +271,8 @@ OBJECTS
|
|||||||
|
|
||||||
<!ELEMENT objects (object)*>
|
<!ELEMENT objects (object)*>
|
||||||
|
|
||||||
<!ELEMENT object (file,attribute*,noteref*,(daterange|dateval|datestr)?,
|
<!ELEMENT object (file,attribute*,noteref*,
|
||||||
sourceref*)>
|
(daterange|datespan|dateval|datestr)?,sourceref*)>
|
||||||
<!ATTLIST object
|
<!ATTLIST object
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
@ -358,6 +358,14 @@ SHARED ELEMENTS
|
|||||||
cformat CDATA #IMPLIED
|
cformat CDATA #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT datespan EMPTY>
|
||||||
|
<!ATTLIST datespan
|
||||||
|
start CDATA #REQUIRED
|
||||||
|
stop CDATA #REQUIRED
|
||||||
|
quality (estimated|calculated) #IMPLIED
|
||||||
|
cformat CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT dateval EMPTY>
|
<!ELEMENT dateval EMPTY>
|
||||||
<!ATTLIST dateval
|
<!ATTLIST dateval
|
||||||
val CDATA #REQUIRED
|
val CDATA #REQUIRED
|
||||||
|
@ -263,6 +263,15 @@
|
|||||||
</choice></attribute></optional>
|
</choice></attribute></optional>
|
||||||
<optional><attribute name="cformat"><text/></attribute></optional>
|
<optional><attribute name="cformat"><text/></attribute></optional>
|
||||||
</element>
|
</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">
|
<element name="dateval">
|
||||||
<attribute name="val"><text/></attribute>
|
<attribute name="val"><text/></attribute>
|
||||||
<optional><attribute name="cformat"><text/></attribute></optional>
|
<optional><attribute name="cformat"><text/></attribute></optional>
|
||||||
|
@ -793,11 +793,16 @@ class GrampsDbXmlWriter(object):
|
|||||||
mode = date.get_modifier()
|
mode = date.get_modifier()
|
||||||
|
|
||||||
if date.is_compound():
|
if date.is_compound():
|
||||||
|
if mode == RelLib.Date.MOD_RANGE:
|
||||||
|
tagname = 'daterange'
|
||||||
|
else:
|
||||||
|
tagname = 'datespan'
|
||||||
|
|
||||||
d1 = self.get_iso_date(date.get_start_date())
|
d1 = self.get_iso_date(date.get_start_date())
|
||||||
d2 = self.get_iso_date(date.get_stop_date())
|
d2 = self.get_iso_date(date.get_stop_date())
|
||||||
if d1 != "" or d2 != "":
|
if d1 != "" or d2 != "":
|
||||||
self.g.write('%s<daterange start="%s" stop="%s"%s%s/>\n'
|
self.g.write('%s<%s start="%s" stop="%s"%s%s/>\n'
|
||||||
% (sp,d1,d2,qual_str,calstr))
|
% (sp,tagname,d1,d2,qual_str,calstr))
|
||||||
elif mode != RelLib.Date.MOD_TEXTONLY:
|
elif mode != RelLib.Date.MOD_TEXTONLY:
|
||||||
date_str = self.get_iso_date(date.get_start_date())
|
date_str = self.get_iso_date(date.get_start_date())
|
||||||
if date_str == "":
|
if date_str == "":
|
||||||
|
@ -412,6 +412,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
"place" : (self.start_place, self.stop_place),
|
"place" : (self.start_place, self.stop_place),
|
||||||
"dateval" : (self.start_dateval, None),
|
"dateval" : (self.start_dateval, None),
|
||||||
"daterange" : (self.start_daterange, None),
|
"daterange" : (self.start_daterange, None),
|
||||||
|
"datespan" : (self.start_datespan, None),
|
||||||
"datestr" : (self.start_datestr, None),
|
"datestr" : (self.start_datestr, None),
|
||||||
"places" : (None, self.stop_places),
|
"places" : (None, self.stop_places),
|
||||||
"placeobj" : (self.start_placeobj,self.stop_placeobj),
|
"placeobj" : (self.start_placeobj,self.stop_placeobj),
|
||||||
@ -1421,6 +1422,12 @@ class GrampsParser(UpdateCallback):
|
|||||||
self.placeobj.add_media_reference(self.pref)
|
self.placeobj.add_media_reference(self.pref)
|
||||||
|
|
||||||
def start_daterange(self,attrs):
|
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:
|
if self.source_ref:
|
||||||
dv = self.source_ref.get_date_object()
|
dv = self.source_ref.get_date_object()
|
||||||
elif self.ord:
|
elif self.ord:
|
||||||
@ -1483,7 +1490,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
else:
|
else:
|
||||||
qual = RelLib.Date.QUAL_NONE
|
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):
|
def start_dateval(self,attrs):
|
||||||
if self.source_ref:
|
if self.source_ref:
|
||||||
|
Loading…
Reference in New Issue
Block a user