##// END OF EJS Templates
Parse any heading level (#11789)....
Jean-Philippe Lang -
r10111:bcb4c2cde49e
parent child
Show More
@@ -822,7 +822,7 module ApplicationHelper
822 end
822 end
823 end
823 end
824
824
825 HEADING_RE = /(<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>)/i unless const_defined?(:HEADING_RE)
825 HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE)
826
826
827 def parse_sections(text, project, obj, attr, only_path, options)
827 def parse_sections(text, project, obj, attr, only_path, options)
828 return unless options[:edit_section_links]
828 return unless options[:edit_section_links]
@@ -919,6 +919,8 module ApplicationHelper
919 # Renders the TOC with given headings
919 # Renders the TOC with given headings
920 def replace_toc(text, headings)
920 def replace_toc(text, headings)
921 text.gsub!(TOC_RE) do
921 text.gsub!(TOC_RE) do
922 # Keep only the 4 first levels
923 headings = headings.select{|level, anchor, item| level <= 4}
922 if headings.empty?
924 if headings.empty?
923 ''
925 ''
924 else
926 else
General Comments 0
You need to be logged in to leave comments. Login now