summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-19 23:03:07 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-19 23:03:07 +0000
commitba42e1e2ff99a83852af892eb5de72db24007a30 (patch)
treeb4320c1072aba852c81c33020f68645dc3e242a2
parent14074da8b1806f62b32a264cf01a8b055fee3ea7 (diff)
downloadredmine-ba42e1e2ff99a83852af892eb5de72db24007a30.tar.gz
redmine-ba42e1e2ff99a83852af892eb5de72db24007a30.zip
Merged r3786 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3794 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/wiki_formatting/textile/formatter.rb3
-rw-r--r--test/unit/helpers/application_helper_test.rb2
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb
index 70ddb13d7..77fe8014e 100644
--- a/lib/redmine/wiki_formatting/textile/formatter.rb
+++ b/lib/redmine/wiki_formatting/textile/formatter.rb
@@ -67,6 +67,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 a15b51807..a49ab58d3 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -364,6 +364,7 @@ h2. Subtitle with %{color:red}red text%
h1. Another title
+h2. An "Internet link":http://www.redmine.org/ inside subtitle
RAW
expected = '<ul class="toc">' +
@@ -372,6 +373,7 @@ RAW
'<li class="heading2"><a href="#Subtitle-with-another-Wiki-link">Subtitle with another Wiki link</a></li>' +
'<li class="heading2"><a href="#Subtitle-with-red-text">Subtitle with red text</a></li>' +
'<li class="heading1"><a href="#Another-title">Another title</a></li>' +
+ '<li class="heading2"><a href="#An-Internet-link-inside-subtitle">An Internet link inside subtitle</a></li>' +
'</ul>'
assert textilizable(raw).gsub("\n", "").include?(expected)