From 91329e6339e7cf46d95e05ee168f119b3c54fb84 Mon Sep 17 00:00:00 2001 From: stev Date: Sat, 9 Sep 2023 23:21:43 +0200 Subject: [PATCH] fix process_list() function to handle IndexError exception as well as lines starting with '*' that were not list items. --- src/gmirator/generate.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/gmirator/generate.py b/src/gmirator/generate.py index b56168d..5697b69 100644 --- a/src/gmirator/generate.py +++ b/src/gmirator/generate.py @@ -134,15 +134,18 @@ def process_file(ifile: TextIOWrapper): return contents, title def process_list(line: str, in_list: bool): - if in_list: - if line[0] == "*": - line = re.sub(r'^\* (.*)', r'
  • \1
  • ', line) - else: - in_list = False - line = "\n\n" - elif line[0] == "*": - line = "\n\n{line}" + elif line[:2] == "* ": + line = "