Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/libnntpchan/template_engine.cpp

36 lines
791 B
C++
Raw Normal View History

#include "template_engine.hpp"
#include "sanitize.hpp"
namespace nntpchan
{
struct MustacheTemplateEngine : public TemplateEngine
{
struct Impl
{
bool RenderFile(const std::string & fname, const Args_t & args, const FileHandle_ptr & out)
{
auto file = OpenFile(fname, eRead);
return true;
}
};
virtual bool WriteTemplate(const std::string & fname, const Args_t & args, const FileHandle_ptr & out)
{
auto impl = std::make_unique<Impl>();
return impl->RenderFile(fname, args, out);
}
};
TemplateEngine * CreateTemplateEngine(const std::string & dialect)
{
auto d = ToLower(dialect);
if(d == "mustache")
return new MustacheTemplateEngine;
else
return nullptr;
}
}