summaryrefslogtreecommitdiff
path: root/src/block-parser.h
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2012-12-24 20:10:27 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2012-12-24 20:10:27 +0100
commitc5e75352f27a02501b3a1a9189f10a581c12e7fb (patch)
treeb3bdae02b91bbb7ab4f5bb48b9704dbf378ce533 /src/block-parser.h
parentdff418800174265b1a591ac44eb244e2b16f94a5 (diff)
downloadcataract-c5e75352f27a02501b3a1a9189f10a581c12e7fb.tar.xz
block-parser: Add support for custom block functions
Similar to replace-table custom functions, this brings an ability to register custom block functions that can be called from templates with variable arguments. The syntax is as follows: <!-- $(if (function_name(arg1, "arg2", 'arg3'))) --> ... <!-- $(endif (function_name(arg1, "arg2", 'arg3'))) --> An optional exclamation mark before the function name reverts the result (negates) the predicate. This allows template flexibility with respect to the currently processed image.
Diffstat (limited to 'src/block-parser.h')
-rw-r--r--src/block-parser.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/block-parser.h b/src/block-parser.h
index 96c7fb8..edf6dd2 100644
--- a/src/block-parser.h
+++ b/src/block-parser.h
@@ -26,6 +26,11 @@ G_BEGIN_DECLS
typedef struct BlockParser BlockParser;
+/*
+ * conditional function callback, arguments passed as strings. Returning TRUE means not to ignore the block.
+ */
+typedef gboolean (*BlockParserConditionalFunction) (gchar **args, gpointer user_data);
+
BlockParser * block_parser_new ();
@@ -47,6 +52,12 @@ void block_parser_set_conditionals (BlockParser *parser, GHashTable *conditional
void block_parser_register_key (BlockParser *parser, const gchar *key, const gchar *replace_key);
/*
+ * block_parser_register_function: function called to determine whether a block should be ignored or not
+ *
+ */
+void block_parser_register_function (BlockParser *parser, const gchar *conditional_name, BlockParserConditionalFunction callback, gpointer user_data);
+
+/*
* block_parser_get_data: return retrieved data or NULL if none read yet
* returns newly allocated string, caller is responsible for freeing
*