]> source.dussan.org Git - redmine.git/commitdiff
Merged r10294 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 6 Sep 2012 17:21:53 +0000 (17:21 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 6 Sep 2012 17:21:53 +0000 (17:21 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.0-stable@10298 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 70ab097fa5320b6ddb4f0fed0f554222c138609e..63c040a0247f9bf0e027fef6d5242acfe5c00656 100644 (file)
@@ -812,7 +812,7 @@ module ApplicationHelper
     end
   end
 
-  HEADING_RE = /(<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>)/i unless const_defined?(:HEADING_RE)
+  HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE)
 
   def parse_sections(text, project, obj, attr, only_path, options)
     return unless options[:edit_section_links]
@@ -883,6 +883,8 @@ module ApplicationHelper
   # Renders the TOC with given headings
   def replace_toc(text, headings)
     text.gsub!(TOC_RE) do
+      # Keep only the 4 first levels
+      headings = headings.select{|level, anchor, item| level <= 4}
       if headings.empty?
         ''
       else