diff --git a/.gitignore b/.gitignore index a0879b9..2e29fca 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,23 @@ Testing Makefile bin examples/company_report/company_report_stache +/.vs/boostache +/x64 +/boostache.VC.db +*.obj +Debug_Test/boostache.tlog/boostache.lastbuildstate +.vs/boostache - Copy/v15/.suo +.vs/boostache - Copy/v15/Browse.VC.db +*.ipch +.vs/ProjectSettings.json +.vs/slnx.sqlite +.vs/VSWorkspaceState.json +*.tlog +boostache.vcxproj.user +*.pdb +*.sln +*.vcxproj +*.vcxproj.* +/*.vcxproj +/*.filters +/*.sln diff --git a/Demo.txt b/Demo.txt new file mode 100644 index 0000000..6a3e3fd --- /dev/null +++ b/Demo.txt @@ -0,0 +1,59 @@ +https://mustache.github.io/#demo + + +// Mustache + +
The list is empty.
+{{/empty}} + + + +// JSON + +{ + "header": "Colors", + "name": "outer_color", + "items": [ + {"name": "red", "first": true, "url": "#Red"}, + {"name": "green", "link": true, "url": "#Green"}, + {"name": "blue", "link": true, "url": "#Blue"} + ], + "tag":{ + "name3":"inner_color", + "items2": [ + {"name2": "red2", "first": true, "url": "#Red"}, + {"name": "green2", "link": true, "url": "#Green"}, + {"name": "blue2", "link": true, "url": "#Blue"} + ] }, + "empty": false +} + + +// Rendered + +The list is empty.< / p>\n\
+ {{ / empty}}\
+");
+ // ------------------------------------------------------------------
+
+ // ------------------------------------------------------------------
+ // The data description. Just a simple map of strings to strings.
+ map_t data = { { "name" , "Jeroen" },
+ { "age" , "42" }
+ };
+ // ------------------------------------------------------------------
+
+ // ------------------------------------------------------------------
+ // Load the template.
+ // This parses the input and compiles the result. The return is the
+ // compiled data structure
+ using boostache::load_template;
+ using boostache::format::stache;
+
+ auto iter = input.begin();
+ auto templ = load_template