##// END OF EJS Templates
Use names instead of ids for wiki anchors (#6905)....
Jean-Philippe Lang -
r5015:3328a1fc37fe
parent child
Show More
@@ -713,7 +713,7 module ApplicationHelper
713 item = strip_tags(content).strip
713 item = strip_tags(content).strip
714 anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
714 anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
715 @parsed_headings << [level, anchor, item]
715 @parsed_headings << [level, anchor, item]
716 "<h#{level} #{attrs} id=\"#{anchor}\">#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">&para;</a></h#{level}>"
716 "<a name=\"#{anchor}\"></a>\n<h#{level} #{attrs}>#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">&para;</a></h#{level}>"
717 end
717 end
718 end
718 end
719
719
@@ -526,6 +526,13 EXPECTED
526 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
526 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
527 end
527 end
528
528
529 def test_headings
530 raw = 'h1. Some heading'
531 expected = %|<a name="Some-heading"></a>\n<h1 >Some heading<a href="#Some-heading" class="wiki-anchor">&para;</a></h1>|
532
533 assert_equal expected, textilizable(raw)
534 end
535
529 def test_table_of_content
536 def test_table_of_content
530 raw = <<-RAW
537 raw = <<-RAW
531 {{toc}}
538 {{toc}}
General Comments 0
You need to be logged in to leave comments. Login now