Anonymous avatar Anonymous committed bb3bc55

Bugfix re URLs surrounded by []. Bug #32.

Comments (0)

Files changed (3)

 tip (development version)
 -------------------------
 
+* webhelpers.html.tools:
+
+ - Bugfix re URLs surrounded by [].  Bug #32.
+
+1.0rc1 (2010-05-24)
+-------------------
+
 * webhelpers.html.tags:
 
  - Change 'id' argument to all form field helpers. The default value is now

tests/test_tools.py

             literal('http://www.pylonshq.com/contact;new?with=query&string=params'),
             literal('http://www.pylonshq.com/~minam/contact;new?with=query&string=params'),
             literal('http://en.wikipedia.org/wiki/Wikipedia:Today%27s_featured_picture_%28animation%29/January_20%2C_2007'),
-            literal('http://www.pylonshq.com/foo.cgi?date=01/01/01')
+            literal('http://www.pylonshq.com/foo.cgi?date=01/01/01'),
             ]
         for url in urls:
             self.assertEqual('<a href="%s">%s</a>' % (url, url),
                              auto_link(url))
 
+    def test_auto_link_with_brackets(self):
+        self.assertEqual(
+            '[<a href="http://www.example.com">http://www.example.com</a>]',
+            auto_link('[http://www.example.com]'))
+
     def test_auto_linking(self):
         raw_values = {
             'email_raw': literal('david@loudthinking.com'),

webhelpers/html/tools.py

                           (?:\?[\w\+\/%&=.;-]+)?     # query string
                           (?:\#[\w\-]*)?           # trailing anchor
                         )
-                        ([\.,"'?!;:]|\s|<|$)       # trailing text
+                        ([\.,"'?!;:]|\s|<|\]|$)       # trailing text
                            """, re.X)
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.