[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: expose templating API for in-mem
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: expose templating API for in-memory data |
Date: |
Fri, 16 Dec 2022 16:00:15 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 28dfae3e expose templating API for in-memory data
28dfae3e is described below
commit 28dfae3e7c5d7291a4036358050c9c886ee43316
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Dec 16 16:00:13 2022 +0100
expose templating API for in-memory data
---
contrib/gana | 2 +-
src/include/taler_templating_lib.h | 17 +++++++++++++++++
src/templating/templating_api.c | 25 +++++++++++++++++++++++++
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/contrib/gana b/contrib/gana
index 149aa0a0..20f8eb7a 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 149aa0a08d787419e02277ef231d93c6a0154a47
+Subproject commit 20f8eb7a72e2160409f0f78264ec5198e9caa193
diff --git a/src/include/taler_templating_lib.h
b/src/include/taler_templating_lib.h
index e4f3f1f1..53946b9c 100644
--- a/src/include/taler_templating_lib.h
+++ b/src/include/taler_templating_lib.h
@@ -24,6 +24,23 @@
#include <microhttpd.h>
+/**
+ * Fill in Mustach template @a tmpl using the data from @a root
+ * and return the result in @a result.
+ *
+ * @param tmpl 0-terminated string with Mustach template
+ * @param root JSON data to fill into the template
+ * @param[out] result where to write the result
+ * @param[out] result_size where to write the length of the result
+ * @return 0 on success, otherwise Mustach-specific error code
+ */
+int
+TALER_TEMPLATING_fill (const char *tmpl,
+ const json_t *root,
+ void **result,
+ size_t *result_size);
+
+
/**
* Load a @a template and substitute using @a root, returning the result in a
* @a reply encoded suitable for the @a connection with the given @a
diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c
index 47ada208..324e199e 100644
--- a/src/templating/templating_api.c
+++ b/src/templating/templating_api.c
@@ -171,6 +171,31 @@ make_static_url (struct MHD_Connection *con,
}
+int
+TALER_TEMPLATING_fill (const char *tmpl,
+ const json_t *root,
+ void **result,
+ size_t *result_size)
+{
+ int eno;
+
+ if (0 !=
+ (eno = mustach_jansson (tmpl,
+ (json_t *) root,
+ (char **) result,
+ result_size)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "mustach failed on template with error %d\n",
+ eno);
+ *result = NULL;
+ *result_size = 0;
+ return eno;
+ }
+ return eno;
+}
+
+
enum GNUNET_GenericReturnValue
TALER_TEMPLATING_build (struct MHD_Connection *connection,
unsigned int *http_status,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: expose templating API for in-memory data,
gnunet <=