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
This commit is contained in:
parent
b38b871c7f
commit
08b40a67ca
|
@ -713,7 +713,7 @@ module ApplicationHelper
|
||||||
item = strip_tags(content).strip
|
item = strip_tags(content).strip
|
||||||
anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
||||||
@parsed_headings << [level, anchor, item]
|
@parsed_headings << [level, anchor, item]
|
||||||
"<h#{level} #{attrs} id=\"#{anchor}\">#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">¶</a></h#{level}>"
|
"<a name=\"#{anchor}\"></a>\n<h#{level} #{attrs}>#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">¶</a></h#{level}>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,13 @@ EXPECTED
|
||||||
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_headings
|
||||||
|
raw = 'h1. Some heading'
|
||||||
|
expected = %|<a name="Some-heading"></a>\n<h1 >Some heading<a href="#Some-heading" class="wiki-anchor">¶</a></h1>|
|
||||||
|
|
||||||
|
assert_equal expected, textilizable(raw)
|
||||||
|
end
|
||||||
|
|
||||||
def test_table_of_content
|
def test_table_of_content
|
||||||
raw = <<-RAW
|
raw = <<-RAW
|
||||||
{{toc}}
|
{{toc}}
|
||||||
|
|
Loading…
Reference in New Issue