summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-10-29 21:54:04 +0000
committerGo MAEDA <maeda@farend.jp>2019-10-29 21:54:04 +0000
commit19990751a542a68aa183730ae63cc9495958eb86 (patch)
tree89d5f8482ebf77f883ae004367347af5257b6622
parentfbaaa412ea77aab4efc7585f1973c6872971ee8a (diff)
downloadredmine-19990751a542a68aa183730ae63cc9495958eb86.tar.gz
redmine-19990751a542a68aa183730ae63cc9495958eb86.zip
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
-rw-r--r--lib/redmine/wiki_formatting/markdown/formatter.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb5
2 files changed, 6 insertions, 1 deletions
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: