0001624: Source reference hyperlinks do not always work in Narrated Web Site

svn: r9971
This commit is contained in:
Brian Matherly 2008-02-01 02:23:51 +00:00
parent 7ede2b4376
commit d45a2fc957
2 changed files with 30 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2008-01-31 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_Bibliography.py: Fix 0001624: Source reference hyperlinks
do not always work in Narrated Web Site
2008-01-28 Benny Malengier <benny.malengier@gramps-project.org> 2008-01-28 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/MarkerReport.py: fix bug #1669 with None type cmp * src/plugins/MarkerReport.py: fix bug #1669 with None type cmp

View File

@ -24,6 +24,8 @@ Contain and organize bibliographic information.
""" """
import string import string
from gen.lib import SourceRef as SourceRef
class Citation: class Citation:
""" """
Store information about a citation and all of its references. Store information about a citation and all of its references.
@ -132,7 +134,7 @@ class Bibliography:
""" """
source_handle = source_ref.get_reference_handle() source_handle = source_ref.get_reference_handle()
cindex = 0 cindex = 0
rkey = None rkey = ""
citation = None citation = None
citation_found = False citation_found = False
for citation in self.__citation_list: for citation in self.__citation_list:
@ -150,7 +152,8 @@ class Bibliography:
if self.__sref_has_info(source_ref): if self.__sref_has_info(source_ref):
for key, ref in citation.get_ref_list(): for key, ref in citation.get_ref_list():
if self.__srefs_are_equal(ref, source_ref): if self.__srefs_are_equal(ref, source_ref):
# if a reference like this already exists, don't add another one # if a reference like this already exists, don't add
# another one
return (cindex, key) return (cindex, key)
rkey = citation.add_reference(source_ref) rkey = citation.add_reference(source_ref)
@ -175,14 +178,20 @@ class Bibliography:
return self.__citation_list return self.__citation_list
def __sref_has_info(self, source_ref): def __sref_has_info(self, source_ref):
"""
Determine if this source_ref has any useful information based on the
current mode.
"""
if ( self.mode & self.MODE_PAGE ) == self.MODE_PAGE: if ( self.mode & self.MODE_PAGE ) == self.MODE_PAGE:
if source_ref.get_page() != "": if source_ref.get_page() != "":
return True return True
if ( self.mode & self.MODE_DATE ) == self.MODE_DATE: if ( self.mode & self.MODE_DATE ) == self.MODE_DATE:
if source_ref.get_date_object() != None: date = source_ref.get_date_object()
if date != None and not date.is_empty():
return True return True
if ( self.mode & self.MODE_CONF ) == self.MODE_CONF: if ( self.mode & self.MODE_CONF ) == self.MODE_CONF:
if source_ref.get_confidence_level() != None: confidence = source_ref.get_confidence_level()
if confidence != None and confidence != SourceRef.CONF_NORMAL:
return True return True
if ( self.mode & self.MODE_NOTE ) == self.MODE_NOTE: if ( self.mode & self.MODE_NOTE ) == self.MODE_NOTE:
if len(source_ref.get_note_list()) != 0: if len(source_ref.get_note_list()) != 0:
@ -191,6 +200,10 @@ class Bibliography:
return False return False
def __srefs_are_equal(self, source_ref1, source_ref2): def __srefs_are_equal(self, source_ref1, source_ref2):
"""
Determine if two source references are equal based on the
current mode.
"""
if self.mode == self.MODE_ALL: if self.mode == self.MODE_ALL:
return source_ref1.is_equal(source_ref2) return source_ref1.is_equal(source_ref2)
if ( self.mode & self.MODE_PAGE ) == self.MODE_PAGE: if ( self.mode & self.MODE_PAGE ) == self.MODE_PAGE: