diff --git a/ChangeLog b/ChangeLog index c5f281b06..be5b3643e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * src/docgen/RTFDoc.py (write_note): Implement function. * src/docgen/AbiWordDoc.py (write_note): Implement function. * src/docgen/AbiWord2Doc.py (write_note): Implement function. + * src/docgen/OpenOfficeDoc.py (write_note): Implement function. 2003-12-11 Don Allingham * src/plugins/WriteFtree.py (FtreeWriter.export): make sure that the diff --git a/src/docgen/AbiWord2Doc.py b/src/docgen/AbiWord2Doc.py index 2abe88d42..2c1a8d274 100644 --- a/src/docgen/AbiWord2Doc.py +++ b/src/docgen/AbiWord2Doc.py @@ -17,6 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # + +# $Id$ + """ Provides a BaseDoc based interface to the AbiWord document format. """ @@ -223,10 +226,9 @@ class AbiWordDoc(BaseDoc.BaseDoc): def write_note(self,text,format,style_name): if format == 1: - for line in text.split('\n'): - self.start_paragraph(style_name) - self.write_text(line) - self.end_paragraph() + self.start_paragraph(style_name) + self.write_text(text) + self.end_paragraph() elif format == 0: for line in text.split('\n\n'): self.start_paragraph(style_name) diff --git a/src/docgen/AbiWordDoc.py b/src/docgen/AbiWordDoc.py index 70826c291..29e2b276c 100644 --- a/src/docgen/AbiWordDoc.py +++ b/src/docgen/AbiWordDoc.py @@ -17,6 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # + +# $Id$ + """ Provides a BaseDoc based interface to the AbiWord document format. """ @@ -237,10 +240,9 @@ class AbiWordDoc(BaseDoc.BaseDoc): def write_note(self,text,format,style_name): if format == 1: - for line in text.split('\n'): - self.start_paragraph(style_name) - self.write_text(line) - self.end_paragraph() + self.start_paragraph(style_name) + self.write_text(text) + self.end_paragraph() elif format == 0: for line in text.split('\n\n'): self.start_paragraph(style_name) diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index cf725daca..704a03e18 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard Python Modules @@ -665,6 +667,30 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): self.f.write('\n') self.new_cell = 1 + def write_note(self,text,format,style_name): + if format == 1: + text = text.replace('&','&') # Must be first + text = text.replace('<','<') + text = text.replace('>','>') + # Replace multiple spaces: have to go from the largest number down + for n in range(text.count(' '),1,-1): + text = text.replace(' '*n, ' ' % (n-1) ) + text = text.replace('\n','') + text = text.replace('\t','') + text = text.replace('<super>','') + text = text.replace('</super>','') + + self.start_paragraph(style_name) + self.f.write(text) + self.end_paragraph() + elif format == 0: + for line in text.split('\n\n'): + self.start_paragraph(style_name) + line = line.replace('\n',' ') + line = string.join(string.split(line)) + self.write_text(line) + self.end_paragraph() + def write_text(self,text): text = text.replace('&','&') # Must be first text = text.replace('<','<')