From c25f05c84885da3d499ce35d5afdcc3dec582552 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Mon, 18 Mar 2024 18:00:08 +0100 Subject: [PATCH] Fixed detection of markdown frontmatter blocks Implemented the smallest / safest fix I could think of, when you're done processing / editing the first frontmatter block skip the rest, don't look for more in the same file. This issue would cause code blocks which had triple dashes at the start of lines (like an RSA public key), to get some funny looking metadata inserted into them. Signed-off-by: Ole Herman Schumacher Elgesem --- generator/_scripts/cfdoc_metadata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generator/_scripts/cfdoc_metadata.py b/generator/_scripts/cfdoc_metadata.py index 5125479b4..b0f7ee12a 100644 --- a/generator/_scripts/cfdoc_metadata.py +++ b/generator/_scripts/cfdoc_metadata.py @@ -135,12 +135,17 @@ def processMetaData(file_path, config): out_file = open(file_path, "w") in_header = False + did_header = False for line in lines: + if did_header: + out_file.write(line) + continue if line.find("---") == 0: in_header = not in_header if not in_header: # write new tags before header is terminated out_file.write("categories: [%s]\n" % category) out_file.write("alias: %s.html\n" % alias) + did_header = True if in_header: # skip hard-coded duplicates if line.find("categories:") == 0: continue