From: Jean-Philippe Lang Date: Mon, 14 Mar 2011 22:01:43 +0000 (+0000) Subject: Use names instead of ids for wiki anchors (#6905). X-Git-Tag: 1.2.0~708 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3328a1fc37fe73357f1e3f22024fa08aab53b522;p=redmine.git Use names instead of ids for wiki anchors (#6905). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5135 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 44cb25ab8..914efd25a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -713,7 +713,7 @@ module ApplicationHelper item = strip_tags(content).strip anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-') @parsed_headings << [level, anchor, item] - "#{content}" + "\n#{content}" end end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6d46aedf0..5cb2c4cc1 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -526,6 +526,13 @@ EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end + def test_headings + raw = 'h1. Some heading' + expected = %|\n

Some heading

| + + assert_equal expected, textilizable(raw) + end + def test_table_of_content raw = <<-RAW {{toc}}