add person-index entries, for book report

svn: r21954
This commit is contained in:
Paul Franklin 2013-04-10 21:56:35 +00:00
parent b7b2ba690a
commit e0ed05653d
3 changed files with 9 additions and 5 deletions

View File

@ -181,7 +181,7 @@ class TextDoc(object):
""" """
raise NotImplementedError raise NotImplementedError
def write_markup(self, text, s_tags): def write_markup(self, text, s_tags, mark=None):
""" """
Writes the text in the current paragraph. Should only be used after a Writes the text in the current paragraph. Should only be used after a
start_paragraph and before an end_paragraph. Not all backends support start_paragraph and before an end_paragraph. Not all backends support
@ -191,8 +191,9 @@ class TextDoc(object):
@param text: text to write. The text is assumed to be _not_ escaped @param text: text to write. The text is assumed to be _not_ escaped
@param s_tags: assumed to be list of styledtexttags to apply to the @param s_tags: assumed to be list of styledtexttags to apply to the
text text
@param mark: IndexMark to use for indexing (if supported)
""" """
self.write_text(text) self.write_text(text, mark=mark)
def write_note(self, text, format, style_name): def write_note(self, text, format, style_name):
""" """

View File

@ -1531,7 +1531,7 @@ links (like ODF) and write PDF from that format.
""" """
self.__write_text(text, mark, links=links) self.__write_text(text, mark, links=links)
def write_markup(self, text, s_tags): def write_markup(self, text, s_tags, mark=None):
""" """
Writes the text in the current paragraph. Should only be used after a Writes the text in the current paragraph. Should only be used after a
start_paragraph and before an end_paragraph. start_paragraph and before an end_paragraph.
@ -1539,9 +1539,10 @@ links (like ODF) and write PDF from that format.
@param text: text to write. The text is assumed to be _not_ escaped @param text: text to write. The text is assumed to be _not_ escaped
@param s_tags: assumed to be list of styledtexttags to apply to the @param s_tags: assumed to be list of styledtexttags to apply to the
text text
@param mark: IndexMark to use for indexing
""" """
markuptext = self._backend.add_markup_from_styled(text, s_tags) markuptext = self._backend.add_markup_from_styled(text, s_tags)
self.__write_text(markuptext, markup=True) self.__write_text(markuptext, mark=mark, markup=True)
def add_media_object(self, name, pos, x_cm, y_cm, alt='', def add_media_object(self, name, pos, x_cm, y_cm, alt='',
style_name=None, crop=None): style_name=None, crop=None):

View File

@ -99,12 +99,14 @@ class RecordsReport(Report):
last_value = None last_value = None
rank = 0 rank = 0
for (number, (sort, value, name, handletype, handle)) in enumerate(top): for (number, (sort, value, name, handletype, handle)) in enumerate(top):
person = self.database.get_person_from_handle(handle)
mark = ReportUtils.get_person_mark(self.database, person)
if value != last_value: if value != last_value:
last_value = value last_value = value
rank = number rank = number
self.doc.start_paragraph('REC-Normal') self.doc.start_paragraph('REC-Normal')
self.doc.write_text(_("%(number)s. ") % {'number': rank+1}) self.doc.write_text(_("%(number)s. ") % {'number': rank+1})
self.doc.write_markup(cuni(name), name.get_tags()) self.doc.write_markup(cuni(name), name.get_tags(), mark)
self.doc.write_text(_(" (%(value)s)") % {'value': str(value)}) self.doc.write_text(_(" (%(value)s)") % {'value': str(value)})
self.doc.end_paragraph() self.doc.end_paragraph()