Commits

Anonymous committed 3cc554c

Tweak PEP regex to prevent linkification in URLs.

Comments (0)

Files changed (3)

extensions/local_replace.py

      make_traceback_link),
 
     # PEP 8, PEP8, PEP 0008, ...
-    (re.compile(r'\b(?<!/)PEP\s*(\d{1,4})\b', re.I),
+    (re.compile(r'\b(?<![/=-])PEP\s*(\d{1,4})(?!/)\b', re.I),
      make_pep_link),
 
     # devguide

extensions/test/local_replace_data.txt

 write a PEP!
 http://wiki.python.org/moin/SummerOfCode/2011/PEP393
 <a href="http://wiki.python.org/moin/SummerOfCode/2011/PEP393">http://wiki.python.org/moin/SummerOfCode/2011/PEP393</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380">https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&qs_apply=pep380
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&amp;qs_apply=pep380">https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&amp;qs_apply=pep380</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/wiki
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/wiki">https://bitbucket.org/rndblnch/cpython-pep380/wiki</a>
+see http://www.python.org/dev/peps/pep-0008/
+see <a href="http://www.python.org/dev/peps/pep-0008/">http://www.python.org/dev/peps/pep-0008/</a>
 ##
 ##
 see the devguide.

extensions/test/test_local_replace.py

                 continue  # skip the comments
             p = PyDevStringHTMLProperty(self.client, 'test', '1',
                                         None, 'test', text)
-            self.assertEqual(p.pydev_hyperlinked(), expected_result)
+            # decode the str -- Unicode strings have a better diff
+            self.assertEqual(p.pydev_hyperlinked().decode(),
+                             expected_result.decode())
 
 # run the tests
 unittest.main()