From: Andrea Zagli Date: Mon, 8 Jul 2019 17:27:54 +0000 (+0200) Subject: Removed initial *; the level start from 1. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=702c1096087fb0d2f1e9e2fad0ed52b7de257151;p=libzakgorg Removed initial *; the level start from 1. --- diff --git a/src/parser.c b/src/parser.c index 4d42b35..4d79879 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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);