add logic to skip all ini sections other than "tags"
authorLukas Hägele <lukas.haegele93@web.de>
Mon, 20 Jan 2025 18:14:51 +0000 (19:14 +0100)
committerLukas Hägele <lukas.haegele93@web.de>
Mon, 20 Jan 2025 18:14:51 +0000 (19:14 +0100)
Makefile
src/html.c

index 640603df89b48f81336e2d40b8eed44961dba627..89988da6533c419dbab6b6985036a90ff682a45e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: build
+all: build convert
 
 build:
        mkdir -p bin
index bc1984312aca1f4a345202e66187b4d243942d5e..a7950fb4d35c05a5b01d81854f23cac62484aefa 100644 (file)
@@ -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("---")))
                 {