From 3328a1fc37fe73357f1e3f22024fa08aab53b522 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 14 Mar 2011 22:01:43 +0000 Subject: [PATCH] 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 --- app/helpers/application_helper.rb | 2 +- test/unit/helpers/application_helper_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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}} -- 2.39.5