From: Lukas Hägele Date: Mon, 20 Jan 2025 18:14:51 +0000 (+0100) Subject: add logic to skip all ini sections other than "tags" X-Git-Url: https://git.lhaegele.de/?a=commitdiff_plain;h=180a9f7243f4dc09d525df908774161698d9da11;p=recipes.git add logic to skip all ini sections other than "tags" --- diff --git a/Makefile b/Makefile index 640603d..89988da 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: build +all: build convert build: mkdir -p bin diff --git a/src/html.c b/src/html.c index bc19843..a7950fb 100644 --- a/src/html.c +++ b/src/html.c @@ -496,6 +496,7 @@ html_parseMarkdown(str Source, arena* Arena) b32 Frontmatter = 0; b32 ExpectShebang = 0; + b32 SkipIniSection = 0; // todo: remove //b32 PreviousLineWasEmpty = 0; @@ -550,13 +551,31 @@ html_parseMarkdown(str Source, arena* Arena) /* could be used to differentiate between different frontmatter languages */ ASSERT(str_equals(Stripped, STR_LITERAL("#!ini"))); } + else if (SkipIniSection) + { + if (str_startsWith(Stripped, STR_LITERAL("["))) + { + if (str_equals(Stripped, STR_LITERAL("[tags]"))) + { + SkipIniSection = 0; + /* skip section header */ + } + } + } else { if (0); else if (str_startsWith(Stripped, STR_LITERAL("["))) { - ASSERT(str_equals(Stripped, STR_LITERAL("[tags]"))); - /* skip section header */ + if (str_equals(Stripped, STR_LITERAL("[tags]"))) + { + /* skip section header */ + } + else + { + /* temporary - remove to parse other sections than tags */ + SkipIniSection = 1; + } } else if (str_startsWith(Stripped, STR_LITERAL("---"))) {