Skip to content
Snippets Groups Projects
Commit 0a2c03ff authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Bug 262 - Handling of newline character and end of text block

parent efd233d6
No related branches found
No related tags found
No related merge requests found
......@@ -29,10 +29,17 @@ def is_body_of_example(line: str):
Returns true if the line is part of the body of an example.
'''
return line == "" or \
line.startswith("\n") or \
line.startswith(".") or \
line.startswith("#") or \
line.startswith(" ") or \
bool(re.match(r'^[a-zA-Z_]*:',line))
def is_last_line(line: str, txt):
'''
Returns true if it is the last line of the text.
'''
return line == txt[len(txt)-1]
def get_example_file_name(line: str):
'''
......@@ -88,6 +95,8 @@ def parse_all_examples(txt):
new_example = "# " + filename + "\n" + linetext
elif new_example != "" and is_body_of_example(linetext):
new_example = new_example + "\n" + linetext
if is_last_line(line, txt):
res.append(Example(filename, new_example))
elif len(new_example) > 0:
res.append(Example(filename, new_example))
new_example = ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment