- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
- 'lib/redmine/wiki_formatting/links_helper.rb'
- 'lib/redmine/wiki_formatting/macros.rb'
- - 'lib/redmine/wiki_formatting/section_helper.rb'
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
- 'test/helpers/application_helper_test.rb'
i = 0
l = 1
inside_pre = false
- @text.split(/(^(?:\S+\r?\n\r?(?:\=+|\-+)|#+.+|(?:~~~|```).*)\s*$)/).each do |part|
+ @text.split(/(^(?:\S+\r?\n\r?(?:=+|-+)|#+ .+|(?:~~~|```).*)\s*$)/).each do |part|
level = nil
if part =~ /\A(~{3,}|`{3,})(\s*\S+)?\s*$/
if !inside_pre
end
elsif inside_pre
# nop
- elsif part =~ /\A(#+).+/
+ elsif part =~ /\A(#+) .+/
level = $1.size
- elsif part =~ /\A.+\r?\n\r?(\=+|\-+)\s*$/
+ elsif part =~ /\A.+\r?\n\r?(=+|-+)\s*$/
level = $1.include?('=') ? 1 : 2
end
if level
assert_section_with_hash STR_WITH_PRE[2], text, 3
end
+ def test_get_section_should_not_recognize_double_hash_issue_reference_as_heading
+ text = <<~STR
+ ## Section A
+
+ This text is a part of Section A.
+
+ ##1 : This is an issue reference, not an ATX heading.
+
+ This text is also a part of Section A.
+ <!-- Section A ends here -->
+ STR
+
+ assert_section_with_hash text.chomp, text, 1
+ end
+
def test_update_section_should_not_escape_pre_content_outside_section
text = STR_WITH_PRE.join("\n\n")
replacement = "New text"