]> saetta.ns0.it Git - libzakgorg/commitdiff
Removed initial *; the level start from 1.
authorAndrea Zagli <azagli@libero.it>
Mon, 8 Jul 2019 17:27:54 +0000 (19:27 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 8 Jul 2019 17:27:54 +0000 (19:27 +0200)
src/parser.c

index 4d42b3582a2a10aa6d68ecdc51b8949432b015ac..4d79879f34d6ffca603f20d6300681cc75bd9502 100644 (file)
@@ -179,7 +179,12 @@ traverse_func (GNode *node,
 {
        Header *h = (Header *)node->data;
 
-       g_printf ("%d: %s\n", g_node_depth (node), h->str);
+       if (h->level == 0)
+               {
+                       return FALSE;
+               }
+
+       g_printf ("%d: %s\n", h->level, h->str);
        if (h->tags != NULL)
                {
                        g_printf ("\tTAGS %s\n", h->tags);
@@ -275,7 +280,7 @@ zak_gorg_parser_parse (ZakGorgParser *zak_gorg_parser)
                                                {
                                                        if (strline[l] == ' ')
                                                                {
-                                                                       h->level = l - 1;
+                                                                       h->level = l;
                                                                        break;
                                                                }
                                                }
@@ -289,11 +294,11 @@ zak_gorg_parser_parse (ZakGorgParser *zak_gorg_parser)
 
                                        if (rx_start > 0)
                                                {
-                                                       h->str = g_strndup (strline, rx_start);
+                                                       h->str = g_strndup (strline + h->level + 1, rx_start - (h->level + 1));
                                                }
                                        else
                                                {
-                                                       h->str = g_strdup (strline);
+                                                       h->str = g_strdup (strline + h->level + 1);
                                                }
                                        g_strstrip (h->str);