[Zope-Checkins] CVS: Zope/lib/python/StructuredText - ClassicDocumentClass.py:1.18 DocumentClass.py:1.34

Andreas Jung andreas@zope.com
Tue, 9 Oct 2001 08:57:02 -0400


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

Modified Files:
	ClassicDocumentClass.py DocumentClass.py 
Log Message:
Multiple links in a paragraph with mixed link notation
(quotation+colon+URL or quotation+comma+whitespace+URL) did not
work properly (thanks to Alastair Burt for reporting and submitting 
the patch).


=== Zope/lib/python/StructuredText/ClassicDocumentClass.py 1.17 => 1.18 ===
 
     text_types = [
-        'doc_href',
+        'doc_href1',
+        'doc_href2',
         'doc_strong',
         'doc_emphasize',
         'doc_literal',
@@ -650,16 +651,23 @@
            return (StructuredTextStrong(s[start:end]), start-2, end+2)
         else:
            return None
-    
-    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,
-        punctuation = re.compile("[\,\.\?\!\;]+").match
+
+
+      
+    def doc_href1(self, s,
+        expr=re.compile("(\"[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)([,]*\s*)" % letters).search
         ):
-        
-        r=expr1(s) or expr2(s)
+        return self.doc_href(s, expr)
 
+    def  doc_href2(self, s,
+        expr=re.compile('(\"[ %s0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)(\s*)' % letters).search
+        ):
+        return self.doc_href(s, expr)
+
+    def doc_href(self, s, expr, punctuation = re.compile("[\,\.\?\!\;]+").match):
+
+        r=expr(s)
+          
         if r:
             # need to grab the href part and the
             # beginning part


=== Zope/lib/python/StructuredText/DocumentClass.py 1.33 => 1.34 ===
     text_types = [
         'doc_sgml',
-        'doc_href',
+        'doc_href1',
+        'doc_href2',
         'doc_strong',
         'doc_emphasize',
         'doc_underline',
@@ -955,13 +956,22 @@
     _ABS_AND_RELATIVE_URL=r'([%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%]+)' % letters
 
     _SPACES = r'(\s*)'
-    
-    def doc_href(self, s,
-                 expr1 = re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search,
-                 expr2 = re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search):
-        
-        punctuation = re.compile(r"[\,\.\?\!\;]+").match
-        r=expr1(s) or expr2(s)
+
+
+    def doc_href1(self, s,
+                  expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search
+                   ):
+        return self.doc_href(s, expr)
+
+    def doc_href2(self, s,
+                  expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search
+                   ):
+         return self.doc_href(s, expr)
+
+
+    def doc_href(self, s, expr, punctuation=re.compile(r"[\,\.\?\!\;]+").match):
+
+        r=expr(s)
 
         if r:
             # need to grab the href part and the