[Zope-Checkins] CVS: Zope/lib/python/StructuredText - ClassicDocumentClass.py:1.19.2.1 ClassicStructuredText.py:1.3.2.1 DocBookClass.py:1.4.2.1 DocumentClass.py:1.41.2.1 HTMLClass.py:1.16.2.1 HTMLWithImages.py:1.4.2.1 ST.py:1.13.60.1

Andreas Jung andreas@zope.com
Fri, 21 Dec 2001 11:01:22 -0500


Update of /cvs-repository/Zope/lib/python/StructuredText
In directory cvs.zope.org:/tmp/cvs-serv25480

Modified Files:
      Tag: Zope-2_5-branch
	ClassicDocumentClass.py ClassicStructuredText.py 
	DocBookClass.py DocumentClass.py HTMLClass.py 
	HTMLWithImages.py ST.py 
Log Message:
code cleanup (merge from trunk)


=== Zope/lib/python/StructuredText/ClassicDocumentClass.py 1.19 => 1.19.2.1 ===
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 
 import re, ST, STDOM
@@ -408,7 +408,7 @@
             result.append(tmp)
         
         subs = paragraph.getSubparagraphs()
-        indent=paragraph.indent
+#        indent=paragraph.indent
         return StructuredTextTable(result,text,subs,indent=paragraph.indent)
             
     def doc_bullet(self, paragraph, expr = re.compile('\s*[-*o]\s+').match):


=== Zope/lib/python/StructuredText/ClassicStructuredText.py 1.3 => 1.3.2.1 ===
     if not r: return ''
     if not r[-1]: del r[-1]
-    tab=' '*level
+    tab=' '*indent
     return "%s%s\n" % (tab,join(r,'\n'+tab))
 
 def reindent(aString, indent=2, already_untabified=0):


=== Zope/lib/python/StructuredText/DocBookClass.py 1.4 => 1.4.2.1 ===
 ##############################################################################
 
-import string
-from string import join, split, find, lstrip
 
 class DocBookClass:
 
@@ -42,13 +40,13 @@
    def __call__(self, doc, level=1):
       r=[]
       self.dispatch(doc, level-1, r.append)
-      return join(r,'')
+      return ''.join(r)
 
    def _text(self, doc, level, output):
       if doc.getNodeName() == 'StructuredTextLiteral':
          output(doc.getNodeValue())
       else:
-         output(lstrip(doc.getNodeValue()))         
+         output(doc.getNodeValue().lstrip())         
 
    def document(self, doc, level, output):
       output('<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n')
@@ -178,20 +176,20 @@
 
 
 def prestrip(v):
-   v=string.replace(v, '\r\n', '\n')
-   v=string.replace(v, '\r', '\n')
-   v=string.replace(v, '\t', '        ')
-   lines=string.split(v, '\n')
+   v=v.replace( '\r\n', '\n')
+   v=v.replace( '\r', '\n')
+   v=v.replace( '\t', '        ')
+   lines=v.split('\n')
    indent=len(lines[0])
    for line in lines:
       if not len(line): continue
-      i=len(line)-len(string.lstrip(line))
+      i=len(line)-len(line.lstrip())
       if i < indent:
          indent=i
    nlines=[]
    for line in lines:
       nlines.append(line[indent:])
-   return string.join(nlines, '\n')
+   return '\n'.join(nlines, '\n')
 
 
 class DocBookChapter(DocBookClass):


=== Zope/lib/python/StructuredText/DocumentClass.py 1.41 => 1.41.2.1 ===
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 
 import re, ST, STDOM
@@ -436,7 +436,7 @@
           for paragraph in new_paragraphs:
              
              if paragraph.getNodeName() is "StructuredTextTable":
-                cells = paragraph.getColumns()
+#                cells = paragraph.getColumns()
                 text = paragraph.getColorizableTexts()
                 text = map(ST.StructuredText,text)
                 text = map(self.__call__,text)


=== Zope/lib/python/StructuredText/HTMLClass.py 1.16 => 1.16.2.1 ===
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 
 from string import join, split, find
@@ -141,7 +141,7 @@
                     c, level, output)
 
     def paragraph(self, doc, level, output):
-        i=0
+
         output('<p>')
         for c in doc.getChildNodes():
             if c.getNodeName() in ['StructuredTextParagraph']:


=== Zope/lib/python/StructuredText/HTMLWithImages.py 1.4 => 1.4.2.1 ===
 from string import join, split, find
 import re, sys, ST
-import time
 
 from HTMLClass import HTMLClass
 


=== Zope/lib/python/StructuredText/ST.py 1.13 => 1.13.60.1 ===
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
+
 import re, STDOM
 from string import split, join, replace, expandtabs, strip, find
 
@@ -156,7 +169,7 @@
                 run = insert(struct,level,currentlevel)
             else:
                 run = struct
-                currentindet = indent
+                currentindent = indent
             run.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel))
     
     return StructuredTextDocument(struct)