Improved algorithm

This commit is contained in:
smitcona
2016-11-22 19:56:57 +00:00
parent 97b72ef767
commit 5685a4055a

View File

@@ -485,17 +485,13 @@ def _correct_splitlines_in_headers(markers, lines):
# Only set in_header_block flag true when we hit an 's' and the line is a header. # Only set in_header_block flag true when we hit an 's' and the line is a header.
if m == 's': if m == 's':
if not in_header_block: if not in_header_block:
if i == 0: if bool(re.search(RE_HEADER, lines[i])):
in_header_block = True in_header_block = True
elif i > 0 and not bool(re.search(RE_HEADER, lines[i-1])):
in_header_block = True
else:
m = 't'
else: else:
m = 't' m = 't'
# If the line is not a header line, set in_header_block false. # If the line is not a header line, set in_header_block false.
if not m == 's' and not bool(re.search(RE_HEADER, lines[i])): if not bool(re.search(RE_HEADER, lines[i])):
in_header_block = False in_header_block = False
# Add the marker to the new updated markers string. # Add the marker to the new updated markers string.