diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f152e21..779b6b8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -883,12 +883,12 @@ module ApplicationHelper def parse_sections(text, project, obj, attr, only_path, options) return unless options[:edit_section_links] text.gsub!(HEADING_RE) do - heading = $1 + heading, level = $1, $2 @current_section += 1 if @current_section > 1 content_tag('div', link_to(image_tag('edit.png'), options[:edit_section_links].merge(:section => @current_section)), - :class => 'contextual', + :class => "contextual heading-#{level}", :title => l(:button_edit_section), :id => "section-#{@current_section}") + heading.html_safe else diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6b0d1c7..949b08b 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -1242,14 +1242,14 @@ RAW result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") # heading that contains inline code - assert_match Regexp.new('
' + + assert_match Regexp.new('
' + 'Edit
' + '' + '

Subtitle with inline code

'), result # last heading - assert_match Regexp.new('
' + + assert_match Regexp.new('
' + 'Edit
' + '' + '

Subtitle after pre tag

'),