summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-24 02:39:21 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-24 02:39:21 +0000
commitd7ec02691f600235e2e05bd70ba29ffd3e800a22 (patch)
treec61174610007866e87737603ff69feec92423c20
parente7790bb6b5a9fc82cb2eeed9796b4d5f5ea1bd32 (diff)
downloadredmine-d7ec02691f600235e2e05bd70ba29ffd3e800a22.tar.gz
redmine-d7ec02691f600235e2e05bd70ba29ffd3e800a22.zip
Merged r3811 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3812 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/wiki_formatting/textile/formatter.rb4
-rw-r--r--test/unit/helpers/application_helper_test.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb
index 77fe8014e..30fe1e7de 100644
--- a/lib/redmine/wiki_formatting/textile/formatter.rb
+++ b/lib/redmine/wiki_formatting/textile/formatter.rb
@@ -69,7 +69,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 a49ab58d3..772a8fbf0 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -365,6 +365,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 = '<ul class="toc">' +
@@ -374,8 +377,9 @@ RAW
'<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>' +
+ '<li class="heading2"><a href="#Project-Name">Project Name</a></li>' +
'</ul>'
-
+
assert textilizable(raw).gsub("\n", "").include?(expected)
end