diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-04-07 07:46:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-04-07 07:46:12 +0000 |
commit | d4d750ccae97aefe1ba8ac7e769afe0fbc29c45e (patch) | |
tree | 98b85d35ba09d7c045067615972b73bb5bbe9aec /lib | |
parent | b683b195a102e9e5c9fadc8f8781c5edab6f2eb9 (diff) | |
download | redmine-d4d750ccae97aefe1ba8ac7e769afe0fbc29c45e.tar.gz redmine-d4d750ccae97aefe1ba8ac7e769afe0fbc29c45e.zip |
Merged r17266 into 3.3-stable (#25299).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@17268 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/wiki_formatting/markdown/formatter.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/redmine/wiki_formatting/markdown/formatter.rb b/lib/redmine/wiki_formatting/markdown/formatter.rb index 2721adf3d..229692779 100644 --- a/lib/redmine/wiki_formatting/markdown/formatter.rb +++ b/lib/redmine/wiki_formatting/markdown/formatter.rb @@ -90,15 +90,13 @@ module Redmine i = 0 l = 1 inside_pre = false - @text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|~~~.*)\s*$)/).each do |part| + @text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|(?:~~~|```).*)\s*$)/).each do |part| level = nil - if part =~ /\A~{3,}(\S+)?\s*$/ - if $1 - if !inside_pre - inside_pre = true - end - else - inside_pre = !inside_pre + if part =~ /\A(~{3,}|`{3,})(\S+)?\s*$/ + if !inside_pre + inside_pre = true + elsif !$2 + inside_pre = false end elsif inside_pre # nop |