diff --git a/README.md b/README.md index 9844b1d..313ba82 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,6 @@ make install clean ``` Run `make help` to see targets, flags and arguments. -Extensions ----------- -* [inja](https://github.com/pantor/inja) (template rendering, - requires [nlohmann/json](https://github.com/nlohmann/json)) - Examples -------- See [examples](examples). diff --git a/config.mk b/config.mk index 422e1f4..bf7638f 100644 --- a/config.mk +++ b/config.mk @@ -31,16 +31,6 @@ ifeq ($(FCGI_SERVER), 1) LDFLAGS += -lfcgi endif -#flag Enable inja extension -EXTENSIONS_INJA ?= 0 -#arg Dist path. Needed only if inja is enabled. -DIST_PATH = /var/www/html -ifneq ($(EXTENSIONS_INJA), 0) - CXXFLAGS+=-DEXTENSIONS_INJA -DDIST_PATH=\"$(DIST_PATH)\" - CXXSTD=-std=c++17 -endif - - #flag Multithread support MT_ENABLED ?= 0 #arg Number of threads. 8 by default. diff --git a/cxx/Response.cxx b/cxx/Response.cxx index b9f95fa..784cbcc 100644 --- a/cxx/Response.cxx +++ b/cxx/Response.cxx @@ -3,10 +3,6 @@ #include "Response.hxx" -#ifdef EXTENSIONS_INJA -#include -#endif - using namespace rpd; int Response::header(const char *key, const char *value) @@ -16,29 +12,3 @@ int Response::header(const char *key, const char *value) key, value); } - -#ifdef EXTENSIONS_INJA -void Response::render(const char *path, nlohmann::json data) -{ - inja::Environment env; - inja::Template tpl; - - try { - std::string tplpath = DIST_PATH; - tplpath += path; - tpl = env.parse_template(tplpath); - } catch (inja::FileError &e) { - std::cerr << e.what() << std::endl; - return; - } - - try { - std::string result = env.render(tpl, data); - body(result.c_str()); - } catch (inja::RenderError &e) { - std::cerr << e.what() << std::endl; - status(rpd_res_st_internal_server_error); - return; - } -} -#endif diff --git a/include/Response.hxx b/include/Response.hxx index 9d7fee1..2ef0c7a 100644 --- a/include/Response.hxx +++ b/include/Response.hxx @@ -8,10 +8,6 @@ #include #include -#ifdef EXTENSIONS_INJA -#include -#endif - namespace rpd { /*! * \brief C++ response wrapper. @@ -80,15 +76,6 @@ public: res->body = strdup(body); } -#ifdef EXTENSIONS_INJA - /*! - * \brief Render data to HTML template. - * \param path Path to HTML template relative to dist location. - * \param data Template data to interpolate. - */ - void render(const char *path, nlohmann::json data); -#endif - /*! * \brief Destructor. */