From 25315ceece505cc328683f23af0f9d5dd5ad4a4d Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 10 Apr 2013 21:56:10 +0000 Subject: [PATCH] add person-index entries, for book report svn: r21953 --- gramps/gen/plug/docgen/textdoc.py | 5 +++-- gramps/plugins/lib/libcairodoc.py | 5 +++-- gramps/plugins/textreport/recordsreport.py | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gramps/gen/plug/docgen/textdoc.py b/gramps/gen/plug/docgen/textdoc.py index 058a3ad94..39acd3850 100644 --- a/gramps/gen/plug/docgen/textdoc.py +++ b/gramps/gen/plug/docgen/textdoc.py @@ -181,7 +181,7 @@ class TextDoc(object): """ 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 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 s_tags: assumed to be list of styledtexttags to apply to the 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): """ diff --git a/gramps/plugins/lib/libcairodoc.py b/gramps/plugins/lib/libcairodoc.py index 5ef596060..813e82883 100644 --- a/gramps/plugins/lib/libcairodoc.py +++ b/gramps/plugins/lib/libcairodoc.py @@ -1531,7 +1531,7 @@ links (like ODF) and write PDF from that format. """ 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 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 s_tags: assumed to be list of styledtexttags to apply to the text + @param mark: IndexMark to use for indexing """ 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='', style_name=None, crop=None): diff --git a/gramps/plugins/textreport/recordsreport.py b/gramps/plugins/textreport/recordsreport.py index d336b3a3f..558fd3e51 100644 --- a/gramps/plugins/textreport/recordsreport.py +++ b/gramps/plugins/textreport/recordsreport.py @@ -99,12 +99,14 @@ class RecordsReport(Report): last_value = None rank = 0 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: last_value = value rank = number self.doc.start_paragraph('REC-Normal') 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.end_paragraph()