[Zope-Checkins] CVS: Zope2 - DocumentClass.py:1.25

chrism@serenade.digicool.com chrism@serenade.digicool.com
Mon, 25 Jun 2001 19:31:17 -0400


Update of /cvs-repository/Zope2/lib/python/StructuredText
In directory serenade:/home/chrism/BackTalk/lib/python/StructuredText

Modified Files:
	DocumentClass.py 
Log Message:
Fixed doc_literal method to allow for start-of-line and end-of-line literals.


--- Updated File DocumentClass.py in package Zope2 --
--- DocumentClass.py	2001/06/25 20:20:30	1.24
+++ DocumentClass.py	2001/06/25 23:31:16	1.25
@@ -858,7 +858,7 @@
 
     def doc_literal(
         self, s,
-        expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
+        expr = re.compile(r"(\W+|^)'([%s%s%s\s]+)'([%s]+|$)" % (letters, digits, literal_punc, phrase_delimiters)).search,):
 
         # old expr... failed to cross newlines.
         #        expr=re.compile(
@@ -867,9 +867,9 @@
         #          r"'(?:\s|[,.;:!?]|$)"  # close
         #          ).search):
         
-        r=expr(s)
+        r=expr(s) #or expr2(s)
         if r:
-           start, end = r.span(1)
+           start, end = r.span(2)
            return (StructuredTextLiteral(s[start:end]), start-1, end+1)
         else:
            return None