Skip to content

Commit 571d1ac

Browse files
author
Drew Batshaw
committed
makes sure bulleted lists are properly marked visible
1 parent 436cab0 commit 571d1ac

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

lib/email_reply_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def scan_line(line)
126126
# Mark the current Fragment as a signature if the current line is empty
127127
# and the Fragment starts with a common signature indicator.
128128
if @fragment && line == EMPTY
129-
if @fragment.lines.last =~ /([\-\_]\s*$)|(^(\w+\s*){1,3} #{"Sent from my".reverse}$)/ #will catch up to 3 words after "sent from my "
129+
if @fragment.lines.last =~ /(--|__|\w-$)|(^(\w+\s*){1,3} #{"Sent from my".reverse}$)/ #will catch up to 3 words after "sent from my "
130130
@fragment.signature = true
131131
finish_fragment
132132
end

test/email_reply_parser_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ def test_do_not_parse_out_send_from_in_regular_sentence
107107
assert_equal "Here is another email\n\nSent from my desk, is much easier then my mobile phone.", EmailReplyParser.parse_reply(body)
108108
end
109109

110+
def test_retains_bullets
111+
body = IO.read EMAIL_FIXTURE_PATH.join("email_bullets.txt").to_s
112+
assert_equal "test 2 this should list second\n\nand have spaces\n\nand retain this formatting\n\n\n - how about bullets\n - and another",
113+
EmailReplyParser.parse_reply(body)
114+
end
110115

111116
def test_parse_reply
112117
body = IO.read EMAIL_FIXTURE_PATH.join("email_1_2.txt").to_s

test/emails/email_bullets.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
test 2 this should list second
2+
3+
and have spaces
4+
5+
and retain this formatting
6+
7+
8+
- how about bullets
9+
- and another
10+
11+
12+
On Fri, Feb 24, 2012 at 10:19 AM, <examples@email.goalengine.com> wrote:
13+
14+
> Give us an example of how you applied what they learned to achieve
15+
> something in your organization
16+
17+
18+
19+
20+
--
21+
22+
*Joe Smith | Director, Product Management*

0 commit comments

Comments
 (0)