diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb index e55d5de32..731c1bc00 100644 --- a/lib/redmine/wiki_formatting/macros.rb +++ b/lib/redmine/wiki_formatting/macros.rb @@ -221,7 +221,7 @@ module Redmine out = ''.html_safe out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed') out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'collapsible', :style => 'display:none;') - out << content_tag('div', textilizable(text, :object => obj), :id => html_id, :class => 'collapsed-text', :style => 'display:none;') + out << content_tag('div', textilizable(text, :object => obj, :headings => false), :id => html_id, :class => 'collapsed-text', :style => 'display:none;') out end diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb index 772fa9555..da0094c0b 100644 --- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb @@ -235,6 +235,22 @@ class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase assert_select_in result, 'a.collapsible', :text => 'Hide example' end + def test_macro_collapse_should_not_break_toc + text = <<-RAW +{{toc}} + +h1. Title + +{{collapse(Show example, Hide example) +h2. Heading +}}" +RAW + + expected_toc = '' + + assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '') + end + def test_macro_child_pages expected = "