[Zope-Checkins] CVS: Zope2 - ClassicDocumentClass.py:1.11.2.3 HTMLClass.py:1.8.2.1 STletters.py:1.1.2.4

andreas@serenade.digicool.com andreas@serenade.digicool.com
Thu, 3 May 2001 12:07:07 -0400


Update of /cvs-repository/Zope2/lib/python/StructuredText
In directory serenade.digicool.com:/tmp/cvs-serv18414

Modified Files:
      Tag: ajung-2_4-STXNG
	ClassicDocumentClass.py HTMLClass.py STletters.py 
Log Message:
minor adjustments, code cleanup



--- Updated File ClassicDocumentClass.py in package Zope2 --
--- ClassicDocumentClass.py	2001/05/02 18:06:33	1.11.2.2
+++ ClassicDocumentClass.py	2001/05/03 16:07:07	1.11.2.3
@@ -85,7 +85,7 @@
 
 import re, ST, STDOM
 from string import split, join, replace, expandtabs, strip, find
-from STletters import letters,lettpunc
+from STletters import letters,lettpunc,punctuations
 
 StringType=type('')
 ListType=type([])
@@ -657,19 +657,9 @@
     def doc_href(
         
         self, s,
-        expr1 = re.compile("(\"[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)" % letters).search,
-        expr2 = re.compile('(\"[ %s0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#]+)(\s*)' % letters).search):
+        expr1 = re.compile("(\"[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)([,]*\s*)" % letters).search,
+        expr2 = re.compile('(\"[ %s0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)(\s*)' % letters).search):
         
-        #expr1=re.compile('\"([ a-zA-Z0-9.:/;,\n\~\(\)\-]+)\"'
-        #                  ':'
-        #                  '([a-zA-Z0-9.:/;,\n\~]+)(?=(\s+|\.|\!|\?))'
-        #                  ).search,
-        #expr2=re.compile('\"([ a-zA-Z0-9./:]+)\"'
-        #                  ',\s+'
-        #                  '([ a-zA-Z0-9@.:/;]+)(?=(\s+|\.|\!|\?))'
-        #                  ).search,
-        
-        punctuation = re.compile("[\,\.\?\!\;]+").match
         r=expr1(s) or expr2(s)
 
         if r:
@@ -679,19 +669,16 @@
             start,e = r.span(1)
             name    = s[start:e]
             name    = replace(name,'"','',2)
-            #start   = start + 1
             st,end   = r.span(3)
-            if punctuation(s[end-1:end]):
-                end = end -1
-            link    = s[st:end]
-            #end     = end - 1                        
             
+            if s[end-1:end] in punctuations: end-=1
+            link    = s[st:end]
+           
             # name is the href title, link is the target
             # of the href
             return (StructuredTextLink(name, href=link),
                     start, end)
             
-            #return (StructuredTextLink(s[start:end], href=s[start:end]),
-            #        start, end)
+
         else:
             return None

--- Updated File HTMLClass.py in package Zope2 --
--- HTMLClass.py	2001/05/02 16:45:55	1.8
+++ HTMLClass.py	2001/05/03 16:07:07	1.8.2.1
@@ -215,7 +215,7 @@
             else:
                 getattr(self, self.element_types[c.getNodeName()])(
                     c, level, output)
-        output('</p>')
+        output('</p>\n')
 
     def link(self, doc, level, output):
         output('<a href="%s">' % doc.href)

--- Updated File STletters.py in package Zope2 --
--- STletters.py	2001/05/03 15:51:32	1.1.2.3
+++ STletters.py	2001/05/03 16:07:07	1.1.2.4
@@ -10,6 +10,6 @@
 import string
 
 letters     = string.letters
-punctuations = string.punctuation + '@'
+punctuations = string.punctuation 
 
 lettpunc    = letters + punctuations