From a0c01b8ab019039094f036a287db6cfdbe9cdca6 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 2 Jan 2022 01:25:07 -0600 Subject: implement markdown() function --- src/argent.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/argent.c') diff --git a/src/argent.c b/src/argent.c index c42161a..7426394 100644 --- a/src/argent.c +++ b/src/argent.c @@ -3,10 +3,14 @@ #include #include "honeysuckle.h" -#include "md4c-html.h" -#include "tinydir.h" #include "options.h" +#include "bindings.h" + + +struct settings { + const char *template_dir; +}; int main(int argc, char **argv) @@ -25,11 +29,27 @@ int main(int argc, char **argv) lua_State *L = luaL_newstate(); luaL_openlibs(L); - error = luaL_dofile(L, opts.conf_filename); + hs_create_table + (L, + hs_str_cfunc("markdown", markdown) + ); + lua_setglobal(L, "argent"); + + error = luaL_loadfile(L, opts.conf_filename); + if (error != 0) { + fprintf(stderr, "error: %s\n", lua_tostring(L, -1)); + lua_close(L); + return error; + } + error = hs_call(L, 0, 1); if (error != 0) { fprintf(stderr, "error: %s\n", lua_tostring(L, -1)); + lua_close(L); + return error; } - + + printf("here!\n"); + lua_close(L); return 0; } -- cgit v1.2.1