From d7a434ea11cd3a1e71c06d4c70d6f52a2919e000 Mon Sep 17 00:00:00 2001 From: veclav talica Date: Fri, 16 Feb 2024 19:59:57 +0500 Subject: [PATCH] fix the_line_after_metadata() --- tools/article_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/article_utils.py b/tools/article_utils.py index f00b20a..f2c730b 100644 --- a/tools/article_utils.py +++ b/tools/article_utils.py @@ -2,7 +2,7 @@ import time, subprocess def the_line_after_metadata(lines: []) -> int: i = 0 - while lines[i].strip(): + while i < len(lines) and lines[i].strip(): i += 1 return i @@ -19,7 +19,7 @@ def parse_metadata(filepath: str) -> {}: result["Date"] = time.gmtime(int(val)) elif key == "Tags": result["Tags"] = [v.strip() for v in val.split(",")] - else: + elif val: result[key] = val result["Last Edit"] = time.gmtime(int(subprocess.getoutput(r"stat -c %Y " + filepath)))