@@ -65,6 +65,9 module Redmine | |||
|
65 | 65 | def textile_p_withtoc(tag, atts, cite, content) |
|
66 | 66 | # removes wiki links from the item |
|
67 | 67 | toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 } |
|
68 | # sanitizes titles from links | |
|
69 | # see redcloth3.rb, same as "#{pre}#{text}#{post}" | |
|
70 | toc_item.gsub!(LINK_RE) { $2+$4+$9 } | |
|
68 | 71 | # removes styles |
|
69 | 72 | # eg. %{color:red}Triggers% => Triggers |
|
70 | 73 | toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1' |
@@ -420,6 +420,7 h2. Subtitle with %{color:red}red text% | |||
|
420 | 420 | |
|
421 | 421 | h1. Another title |
|
422 | 422 | |
|
423 | h2. An "Internet link":http://www.redmine.org/ inside subtitle | |
|
423 | 424 | RAW |
|
424 | 425 | |
|
425 | 426 | expected = '<ul class="toc">' + |
@@ -428,6 +429,7 RAW | |||
|
428 | 429 | '<li class="heading2"><a href="#Subtitle-with-another-Wiki-link">Subtitle with another Wiki link</a></li>' + |
|
429 | 430 | '<li class="heading2"><a href="#Subtitle-with-red-text">Subtitle with red text</a></li>' + |
|
430 | 431 | '<li class="heading1"><a href="#Another-title">Another title</a></li>' + |
|
432 | '<li class="heading2"><a href="#An-Internet-link-inside-subtitle">An Internet link inside subtitle</a></li>' + | |
|
431 | 433 | '</ul>' |
|
432 | 434 | |
|
433 | 435 | assert textilizable(raw).gsub("\n", "").include?(expected) |
General Comments 0
You need to be logged in to leave comments.
Login now