* src/docgen/OpenOfficeDoc.py (write_note): Implement function.

svn: r2514
This commit is contained in:
Alex Roitman 2003-12-13 05:59:35 +00:00
parent 570fd76a2f
commit 2819de10a2
4 changed files with 39 additions and 8 deletions

View File

@ -6,6 +6,7 @@
* src/docgen/RTFDoc.py (write_note): Implement function. * src/docgen/RTFDoc.py (write_note): Implement function.
* src/docgen/AbiWordDoc.py (write_note): Implement function. * src/docgen/AbiWordDoc.py (write_note): Implement function.
* src/docgen/AbiWord2Doc.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 <dallingham@users.sourceforge.net> 2003-12-11 Don Allingham <dallingham@users.sourceforge.net>
* src/plugins/WriteFtree.py (FtreeWriter.export): make sure that the * src/plugins/WriteFtree.py (FtreeWriter.export): make sure that the

View File

@ -17,6 +17,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# 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 a BaseDoc based interface to the AbiWord document format. 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): def write_note(self,text,format,style_name):
if format == 1: if format == 1:
for line in text.split('\n'): self.start_paragraph(style_name)
self.start_paragraph(style_name) self.write_text(text)
self.write_text(line) self.end_paragraph()
self.end_paragraph()
elif format == 0: elif format == 0:
for line in text.split('\n\n'): for line in text.split('\n\n'):
self.start_paragraph(style_name) self.start_paragraph(style_name)

View File

@ -17,6 +17,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# 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 a BaseDoc based interface to the AbiWord document format. 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): def write_note(self,text,format,style_name):
if format == 1: if format == 1:
for line in text.split('\n'): self.start_paragraph(style_name)
self.start_paragraph(style_name) self.write_text(text)
self.write_text(line) self.end_paragraph()
self.end_paragraph()
elif format == 0: elif format == 0:
for line in text.split('\n\n'): for line in text.split('\n\n'):
self.start_paragraph(style_name) self.start_paragraph(style_name)

View File

@ -18,6 +18,8 @@
# 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$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Standard Python Modules # Standard Python Modules
@ -665,6 +667,30 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.f.write('</text:h>\n') self.f.write('</text:h>\n')
self.new_cell = 1 self.new_cell = 1
def write_note(self,text,format,style_name):
if format == 1:
text = text.replace('&','&amp;') # Must be first
text = text.replace('<','&lt;')
text = text.replace('>','&gt;')
# Replace multiple spaces: have to go from the largest number down
for n in range(text.count(' '),1,-1):
text = text.replace(' '*n, ' <text:s text:c="%d"/>' % (n-1) )
text = text.replace('\n','<text:line-break/>')
text = text.replace('\t','<text:tab-stop/>')
text = text.replace('&lt;super&gt;','<text:span text:style-name="GSuper">')
text = text.replace('&lt;/super&gt;','</text:span>')
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): def write_text(self,text):
text = text.replace('&','&amp;') # Must be first text = text.replace('&','&amp;') # Must be first
text = text.replace('<','&lt;') text = text.replace('<','&lt;')