26 lines
718 B
C++
26 lines
718 B
C++
#ifndef TEMPLATING_HPP
|
|
#define TEMPLATING_HPP
|
|
|
|
#include <inja/inja.hpp>
|
|
#include <crow.h>
|
|
#include <string>
|
|
|
|
class Templating {
|
|
public:
|
|
explicit Templating(const std::string& template_dir);
|
|
|
|
crow::response render_template(const std::string& template_name, const inja::json& data);
|
|
crow::response render_template(const std::string& template_name);
|
|
|
|
std::string render_template_string(const std::string& template_name, const inja::json& data);
|
|
std::string render_template_string(const std::string& template_name);
|
|
|
|
private:
|
|
inja::Environment inja_env;
|
|
std::string template_dir; // absolute path to templates
|
|
|
|
std::string preprocess_template(const std::string& template_name);
|
|
};
|
|
|
|
#endif
|