Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quotations.py to fix issue #220 #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions talon/quotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def mark_message_lines(lines):
* m - line that starts with quotation marker '>'
* s - splitter line
* t - presumably lines from the last message in the conversation
* f - forwarded message line

>>> mark_message_lines(['answer', 'From: [email protected]', '', '> question'])
'tsem'
Expand Down Expand Up @@ -287,9 +288,9 @@ def process_marked_lines(lines, markers, return_flags=[False, -1, -1]):
if 's' not in markers and not re.search('(me*){3}', markers):
markers = markers.replace('m', 't')

if re.match('[te]*f', markers):
return_flags[:] = [False, -1, -1]
return lines
# if re.match('[te]*f', markers):
# return_flags[:] = [False, -1, -1]
# return lines

# inlined reply
# use lookbehind assertions to find overlapping entries e.g. for 'mtmtm'
Expand All @@ -304,8 +305,8 @@ def process_marked_lines(lines, markers, return_flags=[False, -1, -1]):
return_flags[:] = [False, -1, -1]
return lines

# cut out text lines coming after splitter if there are no markers there
quotation = re.search('(se*)+((t|f)+e*)+', markers)
# cut out text lines coming after splitter or forwarded message line if there are no markers there
quotation = re.search('((se*)+((t|f)+e*)+|f)', markers)
if quotation:
return_flags[:] = [True, quotation.start(), len(lines)]
return lines[:quotation.start()]
Expand Down