diff options
| -rw-r--r-- | src/block-parser.c | 20 | ||||
| -rw-r--r-- | src/block-parser.h | 6 | ||||
| -rw-r--r-- | src/generators.c | 14 |
3 files changed, 37 insertions, 3 deletions
diff --git a/src/block-parser.c b/src/block-parser.c index 48c7671..f4ed78b 100644 --- a/src/block-parser.c +++ b/src/block-parser.c @@ -220,6 +220,26 @@ block_parser_set_as_used (BlockParser *parser, const gchar *key) } } +/* + * block_parser_clear_key_data: clear stored data block for the key + * + */ +void +block_parser_clear_key_data (BlockParser *parser, const gchar *key) +{ + BlockData *data = NULL; + + g_assert (parser != NULL); + + data = g_hash_table_lookup (parser->table, key); + if (data != NULL) { + g_free (data->data); + data->data = NULL; + data->used = FALSE; + data->finished = FALSE; + } +} + /* -------------------------------------------------------------------------------------------------------- */ diff --git a/src/block-parser.h b/src/block-parser.h index 5d8b69c..c5a1d9e 100644 --- a/src/block-parser.h +++ b/src/block-parser.h @@ -78,6 +78,12 @@ gboolean block_parser_has_unused_data (BlockParser *parser, const gchar *key); void block_parser_set_as_used (BlockParser *parser, const gchar *key); /* + * block_parser_clear_key_data: clear stored data block for the key + * + */ +void block_parser_clear_key_data (BlockParser *parser, const gchar *key); + +/* * block_parser_process: parse input data * - if there's a multiline block, string before the opening placeholder and * string after closing placeholder are returned on one line, diff --git a/src/generators.c b/src/generators.c index b9df04c..4648f49 100644 --- a/src/generators.c +++ b/src/generators.c @@ -1199,8 +1199,11 @@ write_html_page (TGallerySetup *setup, replace_table_process (&s1, global_replace_table); replace_table_add_key (global_replace_table, "IMG_LIST", s1); g_free (s1); - /* We don't use data from this key directly, let's mark it as used since we've built the structure we needed. */ - block_parser_set_as_used (block_parser, "IMG_LIST"); + /* Clear processed nested keys for further use */ + block_parser_clear_key_data (block_parser, "IMG_LIST"); + block_parser_clear_key_data (block_parser, "LIST_PICTURE"); + block_parser_clear_key_data (block_parser, "LIST_SEPARATOR"); + block_parser_clear_key_data (block_parser, "LIST_INTERSPACE"); } if (block_parser_has_unused_data (block_parser, "NAV_BAR")) { @@ -1210,7 +1213,12 @@ write_html_page (TGallerySetup *setup, replace_table_process (&s1, global_replace_table); replace_table_add_key (global_replace_table, "NAV_BAR", s1); g_free (s1); - block_parser_set_as_used (block_parser, "NAV_BAR"); + block_parser_clear_key_data (block_parser, "NAV_BAR"); + block_parser_clear_key_data (block_parser, "NAV_BAR_FIRST"); + block_parser_clear_key_data (block_parser, "NAV_BAR_ELEM"); + block_parser_clear_key_data (block_parser, "NAV_BAR_LAST"); + block_parser_clear_key_data (block_parser, "NAV_BAR_CURRENT"); + block_parser_clear_key_data (block_parser, "NAV_BAR_CURRENT_ROOT"); } /* Replace all known tags */ |
