From: Go MAEDA Date: Tue, 29 Oct 2019 21:54:04 +0000 (+0000) Subject: Eases the regexp used to determine the start of a code block (#32359). X-Git-Tag: 4.1.0~223 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=19990751a542a68aa183730ae63cc9495958eb86;p=redmine.git Eases the regexp used to determine the start of a code block (#32359). Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@18880 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/wiki_formatting/markdown/formatter.rb b/lib/redmine/wiki_formatting/markdown/formatter.rb index 9082c3658..f4dd56452 100644 --- a/lib/redmine/wiki_formatting/markdown/formatter.rb +++ b/lib/redmine/wiki_formatting/markdown/formatter.rb @@ -90,7 +90,7 @@ module Redmine inside_pre = false @text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|(?:~~~|```).*)\s*$)/).each do |part| level = nil - if part =~ /\A(~{3,}|`{3,})(\S+)?\s*$/ + if part =~ /\A(~{3,}|`{3,})(\s*\S+)?\s*$/ if !inside_pre inside_pre = true elsif !$2 diff --git a/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb index 23d785901..be667c890 100644 --- a/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb @@ -142,6 +142,11 @@ EXPECTED Morbi facilisis accumsan orci non pharetra. + ~~~ ruby + def foo + end + ~~~ + ``` Pre Content: