From 60d290e24f24349fc9434bbf239c2f884b158979 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 18 Apr 2019 20:58:35 +0300 Subject: [PATCH] Allow metadata block in the middle of file --- meta_yaml.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meta_yaml.py b/meta_yaml.py index 3f011fe..83d53f0 100644 --- a/meta_yaml.py +++ b/meta_yaml.py @@ -91,9 +91,14 @@ class MetaYamlPreprocessor(Preprocessor): """ Parse Meta-Data and store in Markdown.Meta. """ yaml_block = [] - line = lines.pop(0) + yaml_start_found = False + while lines: + line = lines.pop(0) + if line == "---": + yaml_start_found = True + break - if line == "---": + if yaml_start_found == True: while lines: line = lines.pop(0) if line in ("---", "..."):