FIX: Do not strip email lines having lists.

This commit is contained in:
Dan Ungureanu
2019-04-16 11:39:16 +03:00
parent 0c35b8b420
commit 35a866fe22
2 changed files with 29 additions and 0 deletions

View File

@ -364,6 +364,10 @@ module Email
text = text.lines.map! do |line|
stripped = line.strip << "\n"
# Do not strip list items.
next line if (stripped[0] == '*' || stripped[0] == '-' || stripped[0] == '+') && stripped[1] == ' '
# Match beginning and ending of code blocks.
if !in_code && stripped[0..2] == '```'
in_code = '```'
elsif in_code == '```' && stripped[0..2] == '```'
@ -374,6 +378,7 @@ module Email
in_code = nil
end
# Strip only lines outside code blocks.
in_code ? line : stripped
end.join
end