diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 7645e02..abffdbc 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -65,6 +65,9 @@ module Redmine def textile_p_withtoc(tag, atts, cite, content) # removes wiki links from the item 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 } # 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 ac3e784..534135e 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -420,6 +420,7 @@ h2. Subtitle with %{color:red}red text% h1. Another title +h2. An "Internet link":http://www.redmine.org/ inside subtitle RAW expected = '