diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index abffdbc..a622e80 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -67,7 +67,9 @@ module Redmine toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 } # sanitizes titles from links # see redcloth3.rb, same as "#{pre}#{text}#{post}" - toc_item.gsub!(LINK_RE) { $2+$4+$9 } + toc_item.gsub!(LINK_RE) { [$2, $4, $9].join } + # sanitizes image links from titles + toc_item.gsub!(IMAGE_RE) { [$5].join } # removes styles # eg. %{color:red}Triggers% => Triggers toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1' diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 534135e..90d3428 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -421,6 +421,9 @@ h2. Subtitle with %{color:red}red text% h1. Another title h2. An "Internet link":http://www.redmine.org/ inside subtitle + +h2. "Project Name !/attachments/1234/logo_small.gif! !/attachments/5678/logo_2.png!":/projects/projectname/issues + RAW expected = '