diff options
author | ipknHama <ipknhama@gmail.com> | 2014-08-07 01:18:33 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2014-08-07 01:18:33 +0900 |
commit | 031615ac866cc3c8f1900dd4b4aae2106ad31230 (patch) | |
tree | b8b7206ffbd2043368580ec269c97436929fe452 /template_test/mustachetest.cc | |
parent | a0c93f5b84cc11b30bc6320ac26127832ef8bf7a (diff) | |
download | crow-031615ac866cc3c8f1900dd4b4aae2106ad31230.tar.gz crow-031615ac866cc3c8f1900dd4b4aae2106ad31230.zip |
source resturcturing + CMake
Diffstat (limited to 'template_test/mustachetest.cc')
-rw-r--r-- | template_test/mustachetest.cc | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/template_test/mustachetest.cc b/template_test/mustachetest.cc deleted file mode 100644 index c4ac2c9..0000000 --- a/template_test/mustachetest.cc +++ /dev/null @@ -1,33 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <iterator> -#include "../mustache.h" -#include "../json.h" -using namespace std; -using namespace crow; -using namespace crow::mustache; - -string read_all(const string& filename) -{ - ifstream is(filename); - return {istreambuf_iterator<char>(is), istreambuf_iterator<char>()}; -} - -int main() -{ - auto data = json::load(read_all("data")); - auto templ = compile(read_all("template")); - auto partials = json::load(read_all("partials")); - set_loader([&](std::string name)->std::string - { - if (partials.count(name)) - { - return partials[name].s(); - } - return ""; - }); - context ctx(data); - cout << templ.render(ctx); - return 0; -} |