From 180a9f7243f4dc09d525df908774161698d9da11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lukas=20H=C3=A4gele?= Date: Mon, 20 Jan 2025 19:14:51 +0100 Subject: [PATCH] add logic to skip all ini sections other than "tags" --- Makefile | 2 +- src/html.c | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) 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("---"))) { -- 2.39.5