diff --git a/ChangeLog b/ChangeLog index bc2ba7228..fa6d80121 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,11 @@ * src/plugins/ReadGedcom.py: Add an "Unknown" address when parsing an incorrect PHON field. + * src/BaseDoc.py (write_note): Add function. + * src/docgen/HtmlDoc.py (write_note): Implement function. + * src/plugins/FtmStyleDescendants.py (print_notes): Call write_note() + with the note's format. + 2003-12-10 Tim Waugh * doc/omf.make: Fixed DESTDIR support. diff --git a/src/BaseDoc.py b/src/BaseDoc.py index 70ed2bf25..a69b46c0e 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -49,13 +49,15 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + """ Provides base interface to text based documents. Specific document interfaces should be derived from the core classes. """ __author__ = "Donald N. Allingham" -__version__ = "Revision:$" +__version__ = "Revision:$Id$" #------------------------------------------------------------------------- # @@ -1279,6 +1281,18 @@ class BaseDoc: "Creates a horizontal line" pass + def write_note(self,text,format,style_name): + """ + Writes the note's text and take care of paragraphs, + depending on the format. + + text - text to write. + format - format to use for writing: + 0 for flowed text, + 1 for preformatted text. + """ + pass + def write_text(self,text): """ Writes the text in the current paragraph. Should only be used after a diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 3ea64d77b..da632ddda 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -435,6 +435,19 @@ class HtmlDoc(BaseDoc.BaseDoc): def end_bold(self): self.f.write('') + def write_note(self,text,format,style_name): + if format == 1: + self.start_paragraph(style_name) + self.f.write('
')
+            self.write_text(text)
+            self.f.write('
') + self.end_paragraph() + elif format == 0: + for line in text.split('\n\n'): + self.start_paragraph(style_name) + self.write_text(line.strip().replace('\n',' ')) + self.end_paragraph() + def write_text(self,text): text = string.replace(text,'&','&'); # Must be first text = string.replace(text,'<','<'); diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index fbf248e70..0fc26a9a9 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -513,10 +513,8 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_('Notes for %(person)s:') % { 'person' : person.getPrimaryName().getRegularName()} ) self.doc.end_paragraph() - for line in note.split('\n'): - self.doc.start_paragraph('FTD-Details') - self.doc.write_text(line.strip()) - self.doc.end_paragraph() + format = person.getNoteFormat() + self.doc.write_note(note,format,'FTD-Details') def print_more_about(self,person):