[Zope-Checkins] CVS: Zope2 - DT_String.py:1.39.52.6

Andreas Jung andreas@dhcp165.digicool.com
Fri, 20 Apr 2001 08:38:51 -0400


Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory yetix:/work/sandboxes/ajung-2_4-ts_regex-exterminiation-branch/lib/python/DocumentTemplate

Modified Files:
      Tag: ajung-2_4-ts_regex-exterminiation-branch
	DT_String.py 
Log Message:
update



--- Updated File DT_String.py in package Zope2 --
--- DT_String.py	2001/04/19 15:10:08	1.39.52.5
+++ DT_String.py	2001/04/20 12:38:50	1.39.52.6
@@ -86,7 +86,7 @@
 "$Id$"
 
 from string import split, strip
-import thread ,re
+import thread,re
 
 from DT_Util import ParseError, InstanceDict, TemplateDict, render_blocks, str
 from DT_Var import Var, Call, Comment
@@ -157,12 +157,12 @@
     def tagre(self):
         return re.compile(
             '%('                                     # beginning
-            '\(?P<name>[a-zA-Z0-9_/.-]+\)'                       # tag name
-            '\('
+            '(?P<name>[a-zA-Z0-9_/.-]+)'                       # tag name
+            '('
             '[\0- ]+'                                # space after tag name
-            '\(?P<args>\([^)"]+\("[^"]*"\)?\)*\)'      # arguments
-            '\)?'
-            ')\(?P<fmt>[0-9]*[.]?[0-9]*[a-z]\|[]![]\)' # end
+            '(?P<args>([^)"]+("[^"]*")?\)*)'      # arguments
+            ')?'
+            ')(?P<fmt>[0-9]*[.]?[0-9]*[a-z]\|[]![])' # end
             , re.I) 
 
     _parseTag__roles__=()
@@ -228,8 +228,10 @@
     def parse(self,text,start=0,result=None,tagre=None):
         if result is None: result=[]
         if tagre is None: tagre=self.tagre()
-        mo=tagre.search(text,start)
-        while mo is not None:
+        mo =tagre.search(text,start)
+        print tagre
+        print mo
+        while mo :
             l = mo.start(0)
 
             try: tag, args, command, coname = self._parseTag(tagre)
@@ -250,20 +252,18 @@
                     result.append(r)
                 except ParseError, m: self.parse_error(m[0],tag,text,l)
 
-            mo =tagre.search(text,start)
+            mo = tagre.search(text,start)
 
         text=text[start:]
         if text: result.append(text)
         return result
 
     skip_eol__roles__=()
-
-    def skip_eol(self, text, start, eol=re.compile('[ \t]*\n',re.I)):
+    def skip_eol(self, text, start, eol=re.compile('[ \t]*\n')):
         # if block open is followed by newline, then skip past newline
-        
-        mo = eol.match(text,start)
+        mo =eol.match(text,start)
         if mo is not None: 
-            start=start+mo.end(0)-mo.start(0)
+            start = start + mo.end(0) - mo.start(0)
 
         return start
 
@@ -280,7 +280,7 @@
         sa=sargs
         while 1:
 
-            mo =tagre.search(text,start)
+            mo = tagre.search(text,start)
             if mo is None: self.parse_error('No closing tag', stag, text, sloc)
             l = mo.start(0)
 
@@ -319,7 +319,7 @@
     parse_close__roles__=()
     def parse_close(self, text, start, tagre, stag, sloc, scommand, sa):
         while 1:
-            mo =tagre.search(text,start)
+            mo = tagre.search(text,start)
             if mo is None: self.parse_error('No closing tag', stag, text, sloc)
             l = mo.start(0)
 
@@ -600,4 +600,3 @@
     """
     manage_edit__roles__=()
     def manage_edit(self,data): raise TypeError, 'cannot edit files'
-