Loading src/example.py +9 −0 Original line number Diff line number Diff line Loading @@ -29,11 +29,18 @@ 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): ''' Looks for the YAML filename in the line of text Loading Loading @@ -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 = "" Loading Loading
src/example.py +9 −0 Original line number Diff line number Diff line Loading @@ -29,11 +29,18 @@ 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): ''' Looks for the YAML filename in the line of text Loading Loading @@ -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 = "" Loading