Project

General

Profile

Defect #5445 » 5445_git.diff

Jean-Baptiste Barth, 2010-06-19 23:04

View differences:

lib/redmine/wiki_formatting/textile/formatter.rb
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'
test/unit/helpers/application_helper_test.rb
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 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)
(4-4/5)