* 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.


svn: r2500
This commit is contained in:
Alex Roitman 2003-12-11 03:49:44 +00:00
parent f33d59dd4b
commit 527e161b42
4 changed files with 35 additions and 5 deletions

View File

@ -10,6 +10,11 @@
* src/plugins/ReadGedcom.py: Add an "Unknown" address when * src/plugins/ReadGedcom.py: Add an "Unknown" address when
parsing an incorrect PHON field. 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 <twaugh@redhat.com> 2003-12-10 Tim Waugh <twaugh@redhat.com>
* doc/omf.make: Fixed DESTDIR support. * doc/omf.make: Fixed DESTDIR support.

View File

@ -49,13 +49,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
""" """
Provides base interface to text based documents. Specific document Provides base interface to text based documents. Specific document
interfaces should be derived from the core classes. interfaces should be derived from the core classes.
""" """
__author__ = "Donald N. Allingham" __author__ = "Donald N. Allingham"
__version__ = "Revision:$" __version__ = "Revision:$Id$"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1279,6 +1281,18 @@ class BaseDoc:
"Creates a horizontal line" "Creates a horizontal line"
pass 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): def write_text(self,text):
""" """
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

View File

@ -435,6 +435,19 @@ class HtmlDoc(BaseDoc.BaseDoc):
def end_bold(self): def end_bold(self):
self.f.write('</b>') self.f.write('</b>')
def write_note(self,text,format,style_name):
if format == 1:
self.start_paragraph(style_name)
self.f.write('<pre>')
self.write_text(text)
self.f.write('</pre>')
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): def write_text(self,text):
text = string.replace(text,'&','&amp;'); # Must be first text = string.replace(text,'&','&amp;'); # Must be first
text = string.replace(text,'<','&lt;'); text = string.replace(text,'<','&lt;');

View File

@ -513,10 +513,8 @@ class FtmDescendantReport(Report.Report):
self.doc.write_text(_('Notes for %(person)s:') % { self.doc.write_text(_('Notes for %(person)s:') % {
'person' : person.getPrimaryName().getRegularName()} ) 'person' : person.getPrimaryName().getRegularName()} )
self.doc.end_paragraph() self.doc.end_paragraph()
for line in note.split('\n'): format = person.getNoteFormat()
self.doc.start_paragraph('FTD-Details') self.doc.write_note(note,format,'FTD-Details')
self.doc.write_text(line.strip())
self.doc.end_paragraph()
def print_more_about(self,person): def print_more_about(self,person):