]> source.dussan.org Git - redmine.git/commitdiff
Less aggressive textile image tag parsing (#3209).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 21 Apr 2009 12:49:16 +0000 (12:49 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 21 Apr 2009 12:49:16 +0000 (12:49 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2677 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth3.rb
test/unit/helpers/application_helper_test.rb

index e0dca80e24196ea058eb9630d93e4a49222992b7..a4d33f8048c2faffcac3311c109bf6209cf6f93c 100644 (file)
@@ -907,7 +907,7 @@ class RedCloth3 < String
     end
 
     IMAGE_RE = /
-            (<p>|.|^)            # start of line?
+            (<p>|\s|^)           # start of line?
             \!                   # opening
             (\<|\=|\>)?          # optional alignment atts
             (#{C})               # optional style,class atts
index a8b7edea5acd830aa8eda5caa4192048d4531360..21ed10ae5509152371a1525b7a343663ee9a37b7 100644 (file)
@@ -57,6 +57,8 @@ class ApplicationHelperTest < HelperTestCase
       'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
       'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
       'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
+      # two exclamation marks
+      'http://example.net/path!602815048C7B5C20!302.html' => '<a class="external" href="http://example.net/path!602815048C7B5C20!302.html">http://example.net/path!602815048C7B5C20!302.html</a>',
     }
     to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
   end
@@ -110,6 +112,8 @@ class ApplicationHelperTest < HelperTestCase
       "This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test",
       # mailto link
       "\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "<a href=\"mailto:sysadmin@example.com?subject=redmine%20permissions\">system administrator</a>",
+      # two exclamation marks
+      '"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>',
     }
     to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
   end