Update DetAncestralReport, DetDescendantReport, IndivComplete and endnotes for citations.

svn: r18513
This commit is contained in:
Tim G L Lyons 2011-11-26 18:35:30 +00:00
parent 78050489d2
commit a48553ed90
4 changed files with 14 additions and 9 deletions

View File

@ -5,6 +5,7 @@
# Copyright (C) 2010 Peter Landgren # Copyright (C) 2010 Peter Landgren
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011 Adam Stein <adam@csh.rit.edu> # Copyright (C) 2011 Adam Stein <adam@csh.rit.edu>
# Copyright (C) 2011 Tim G Lyons
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -76,7 +77,7 @@ def add_endnote_styles(style_sheet):
para.set_description(_('The basic style used for the endnotes reference notes display.')) para.set_description(_('The basic style used for the endnotes reference notes display.'))
style_sheet.add_paragraph_style("Endnotes-Ref-Notes", para) style_sheet.add_paragraph_style("Endnotes-Ref-Notes", para)
def cite_source(bibliography, obj): def cite_source(bibliography, database, obj):
""" """
Cite any sources for the object and add them to the bibliography. Cite any sources for the object and add them to the bibliography.
@ -86,14 +87,15 @@ def cite_source(bibliography, obj):
@type obj: L{gen.lib.srcbase} @type obj: L{gen.lib.srcbase}
""" """
txt = "" txt = ""
slist = obj.get_source_references() slist = obj.get_citation_list()
if slist: if slist:
first = 1 first = 1
for ref in slist: for ref in slist:
if not first: if not first:
txt += ', ' txt += ', '
first = 0 first = 0
(cindex, key) = bibliography.add_reference(ref) citation = database.get_citation_from_handle(ref)
(cindex, key) = bibliography.add_reference(citation)
txt += "%d" % (cindex + 1) txt += "%d" % (cindex + 1)
if key is not None: if key is not None:
txt += key txt += key

View File

@ -8,6 +8,7 @@
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org> # Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Vlada Peri\u0107 # Copyright (C) 2010 Vlada Peri\u0107
# Copyright (C) 2011 Tim G Lyons
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -696,7 +697,7 @@ class DetAncestorReport(Report):
if not obj or not self.inc_sources: if not obj or not self.inc_sources:
return "" return ""
txt = endnotes.cite_source(self.bibli, obj) txt = endnotes.cite_source(self.bibli, self.database, obj)
if txt: if txt:
txt = '<super>' + txt + '</super>' txt = '<super>' + txt + '</super>'
return txt return txt

View File

@ -10,6 +10,7 @@
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Vlada Peri\u0107 # Copyright (C) 2010 Vlada Peri\u0107
# Copyright (C) 2011 Matt Keenan <matt.keenan@gmail.com> # Copyright (C) 2011 Matt Keenan <matt.keenan@gmail.com>
# Copyright (C) 2011 Tim G Lyons
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -858,7 +859,7 @@ class DetDescendantReport(Report):
if not obj or not self.inc_sources: if not obj or not self.inc_sources:
return "" return ""
txt = endnotes.cite_source(self.bibli, obj) txt = endnotes.cite_source(self.bibli, self.database, obj)
if txt: if txt:
txt = '<super>' + txt + '</super>' txt = '<super>' + txt + '</super>'
return txt return txt

View File

@ -6,6 +6,7 @@
# Copyright (C) 2009 Nick Hall # Copyright (C) 2009 Nick Hall
# Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011 Tim G Lyons
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -219,7 +220,7 @@ class IndivCompleteReport(Report):
endnotes = "" endnotes = ""
if self.use_srcs: if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, event) endnotes = Endnotes.cite_source(self.bibli, self.database, event)
self.doc.start_row() self.doc.start_row()
self.normal_cell(column_1) self.normal_cell(column_1)
@ -359,7 +360,7 @@ class IndivCompleteReport(Report):
text = self._name_display.display_name(name) text = self._name_display.display_name(name)
endnotes = "" endnotes = ""
if self.use_srcs: if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, name) endnotes = Endnotes.cite_source(self.bibli, self.database, name)
self.normal_cell(text, endnotes) self.normal_cell(text, endnotes)
self.doc.end_row() self.doc.end_row()
self.doc.end_table() self.doc.end_table()
@ -387,7 +388,7 @@ class IndivCompleteReport(Report):
date = DateHandler.get_date(addr) date = DateHandler.get_date(addr)
endnotes = "" endnotes = ""
if self.use_srcs: if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, addr) endnotes = Endnotes.cite_source(self.bibli, self.database, addr)
self.doc.start_row() self.doc.start_row()
self.normal_cell(date) self.normal_cell(date)
self.normal_cell(text, endnotes) self.normal_cell(text, endnotes)
@ -579,7 +580,7 @@ class IndivCompleteReport(Report):
mark = ReportUtils.get_person_mark(self.database, self.person) mark = ReportUtils.get_person_mark(self.database, self.person)
endnotes = "" endnotes = ""
if self.use_srcs: if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, name) endnotes = Endnotes.cite_source(self.bibli, self.database, name)
self.normal_cell(text, endnotes, mark) self.normal_cell(text, endnotes, mark)
self.doc.end_row() self.doc.end_row()