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