mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 17:26:06 +01:00
Parse any heading level (#11789).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10294 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -822,7 +822,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
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)
|
def parse_sections(text, project, obj, attr, only_path, options)
|
||||||
return unless options[:edit_section_links]
|
return unless options[:edit_section_links]
|
||||||
@@ -919,6 +919,8 @@ module ApplicationHelper
|
|||||||
# Renders the TOC with given headings
|
# Renders the TOC with given headings
|
||||||
def replace_toc(text, headings)
|
def replace_toc(text, headings)
|
||||||
text.gsub!(TOC_RE) do
|
text.gsub!(TOC_RE) do
|
||||||
|
# Keep only the 4 first levels
|
||||||
|
headings = headings.select{|level, anchor, item| level <= 4}
|
||||||
if headings.empty?
|
if headings.empty?
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user