[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/StructuredText/ some more tests for links and links with images

Andreas Jung andreas at andreas-jung.com
Sun Aug 7 09:21:29 EDT 2005


Log message for revision 37769:
  some more tests for links and links with images
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/StructuredText/DocumentWithImages.py
  U   Zope/branches/Zope-2_8-branch/lib/python/StructuredText/tests/testStructuredText.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/StructuredText/DocumentWithImages.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/StructuredText/DocumentWithImages.py	2005-08-07 13:16:15 UTC (rev 37768)
+++ Zope/branches/Zope-2_8-branch/lib/python/StructuredText/DocumentWithImages.py	2005-08-07 13:21:29 UTC (rev 37769)
@@ -27,7 +27,7 @@
 
     def doc_img(
         self, s,
-        expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9%\_\-.:/\?=;,\n\~]+)').search,
+        expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\[\]\'\-\n\~]+)\":img:([a-zA-Z0-9%\_\-.:/\?=;,\n\~]+)').search,
         ):
 
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/StructuredText/tests/testStructuredText.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/StructuredText/tests/testStructuredText.py	2005-08-07 13:16:15 UTC (rev 37768)
+++ Zope/branches/Zope-2_8-branch/lib/python/StructuredText/tests/testStructuredText.py	2005-08-07 13:21:29 UTC (rev 37769)
@@ -211,6 +211,16 @@
 
         self._test('"foo":http://www.zope.org/foo/bar?arg1=1&arg2=2',
                    '<p><a href="http://www.zope.org/foo/bar?arg1=1&arg2=2">foo</a></p>')
+
+        self._test('"foo bar":http://www.zope.org/foo/bar',
+                   '<p><a href="http://www.zope.org/foo/bar">foo bar</a></p>')
+
+        self._test('"[link goes here]":http://www.zope.org/foo/bar',
+                   '<p><a href="http://www.zope.org/foo/bar">[link goes here]</a></p>')
+
+        self._test('"[Dad\'s car]":http://www.zope.org/foo/bar',
+                   '<p><a href="http://www.zope.org/foo/bar">[Dad\'s car]</a></p>')
+
      
     def testImgLink(self):
         self._test('"foo":img:http://www.zope.org/bar.gif',
@@ -225,7 +235,15 @@
         self._test('"foo":img:http://www.zope.org:8080/foo/b%20ar?arg=1',
                    '<img src="http://www.zope.org:8080/foo/b%20ar?arg=1" alt="foo" />')
 
+        self._test('"foo bar":img:http://www.zope.org:8080/foo/bar',
+                   '<img src="http://www.zope.org:8080/foo/bar" alt="foo bar" />')
 
+        self._test('"[link goes here]":img:http://www.zope.org:8080/foo/bar',
+                   '<img src="http://www.zope.org:8080/foo/bar" alt="[link goes here]" />')
+
+        self._test('"[Dad\'s new car]":img:http://www.zope.org:8080/foo/bar',
+                   '<img src="http://www.zope.org:8080/foo/bar" alt="[Dad\'s new car]" />')
+
     def XXXtestUnicodeContent(self):
         # This fails because ST uses the default locale to get "letters"
         # whereas it should use \w+ and re.U if the string is Unicode.



More information about the Zope-Checkins mailing list