{"id":13419244,"url":"https://github.com/mrtazz/plustache","last_synced_at":"2025-10-21T04:03:48.060Z","repository":{"id":62423239,"uuid":"618150","full_name":"mrtazz/plustache","owner":"mrtazz","description":"{{mustaches}} for C++","archived":true,"fork":false,"pushed_at":"2019-02-22T13:05:42.000Z","size":1887,"stargazers_count":202,"open_issues_count":6,"forks_count":46,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-07-31T22:46:33.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"mustache.github.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrtazz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-04-19T17:20:00.000Z","updated_at":"2023-12-19T14:49:21.000Z","dependencies_parsed_at":"2022-11-01T17:45:38.144Z","dependency_job_id":null,"html_url":"https://github.com/mrtazz/plustache","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fplustache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fplustache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fplustache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fplustache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtazz","download_url":"https://codeload.github.com/mrtazz/plustache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690113,"owners_count":20331726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:13.292Z","updated_at":"2025-10-21T04:03:47.563Z","avatar_url":"https://github.com/mrtazz.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"# plustache - mustache templates for C++\n\n[![Build Status](https://travis-ci.org/mrtazz/plustache.svg?branch=master)](https://travis-ci.org/mrtazz/plustache)\n[![Coverage Status](https://coveralls.io/repos/mrtazz/plustache/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/mrtazz/plustache?branch=master)\n[![Packagecloud](https://img.shields.io/badge/packagecloud-available-brightgreen.svg)](https://packagecloud.io/mrtazz/plustache)\n[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n\nBasic port of [mustache templating](http://mustache.github.com) to C++.\n\n## Motivation\nI just wanted to port mustache and build simple templating for C++.\nAnd I am still trying hard to keep it simple.\n\n## Usage\n\n### Simple Usage\nCreate a template:\n\n```html\n\u003ch1\u003e{{title}}\u003c/h1\u003e\nHi I am {{name}}.\nI like {{thing}}.\n```\n\nFill the context:\n\n```C++\n#include \u003cstring\u003e\n#include \u003cplustache/plustache_types.hpp\u003e\n#include \u003cplustache/template.hpp\u003e\n\nusing std::string;\nusing PlustacheTypes::ObjectType;\nusing Plustache::template_t;\n\nObjectType ctx;\nctx[\"title\"] = \"About\";\nctx[\"name\"] = \"Daniel\";\nctx[\"thing\"] = \"turtles\";\n```\n\nInstantiate template class and render the template:\n\n```C++\ntemplate_t t;\nstring template(\"\u003ch1\u003e{{title}}\u003c/h1\u003e\\nHi I am {{name}}.\\nI like {{thing}}.\");\n\nstring result = t.render(template, ctx);\n```\n\nResult:\n\n```html\n\u003ch1\u003eAbout\u003c/h1\u003e\nHi I am Daniel.\nI like turtles.\n```\n\n### Advanced Usage\nCreate the template:\n\n```html\n\u003ch1\u003e {{title}} \u003c/h1\u003e\n\u003cul\u003e\n    {{# friends}}\n      \u003cli\u003e {{name}}\u003c/li\u003e\n      \u003cli\u003e {{job}}\u003c/li\u003e\n      \u003cli\u003e {{status}}\u003c/li\u003e\n    {{/ friends}}\n\u003c/ul\u003e\n```\n\nCreate the context:\n\n```C++\n// create types\ncontext ctx;\nCollectionType c;\nObjectType jim;\nObjectType john;\nObjectType jack;\n// Fill values\nctx.add(\"title\", \"My friends\");\njim[\"name\"] = \"Jim\";\njim[\"job\"] = \"Wizard\";\njim[\"status\"] = \"Eating\";\njohn[\"name\"] = \"John\";\njohn[\"job\"] = \"Rainbow Painter\";\njohn[\"status\"] = \"Sleeping\";\njack[\"name\"] = \"Jack\";\njack[\"job\"] = \"Unicorn Trainer\";\njack[\"status\"] = \"Riding\";\n// enter data\nc.push_back(jim);\nc.push_back(john);\nctx.add(\"friends\", c);\n// also possible\nctx.add(\"friends\", jack);\n```\n\nRender the template:\n\n```C++\ntemplate_t t;\nstring result = t.render(template, ctx);\n```\n\n## Installation\nThere are packages available for some Linux distributions on\n[Packagecloud](https://packagecloud.io/mrtazz/plustache).\n\nOtherwise clone this repository and run the manual install task:\n\n    git clone git://github.com/mrtazz/plustache.git\n    autoreconf -i\n    ./configure\n    make\n    make install\n\nOn OSX you can get it via [my homebrew\ntap](https://github.com/mrtazz/homebrew-oss):\n\n    brew tap mrtazz/oss\n    brew install plustache\n\n## Running the unit tests\n\n### Build the google test library:\n\n    cd vendor/gtest-1.7.0\n    ./configure\n    make\n\nOn OS X, you may get an error:\n\n    vendor/gtest-1.7.0/include/gtest/internal/gtest-port.h:499:13: fatal error:\n    'tr1/tuple' file not found\n    #   include \u003ctr1/tuple\u003e  // NOLINT\n\nIf so, re-run configure with the following argument\n\n    ./configure CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1\n    make\n\n### Build the test program\n\nRun this from the top-level plustache source directory:\n\n    make test-program\n\nIf you get the tr1/tuple error, do:\n\n    ./configure CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1\n    make test-program\n\n### Run the test program\n\n    ./test-program\n\n\n### Building with Microsoft Visual Studio\nThe supplied MSBuild files will look for an installation of boost in the parent\ndirectory of this repo. The boost regex library must be built. For example:\n\n```\ncd boost_1_55_0\nbootstrap\nb2 -j8 toolset=msvc-12.0 address-model=64 --with-regex --prefix=../boost install\n```\n\nThe boost directories and other build parameters can be\nconfigured by creating a\n[Directories.targets](msvc/Directories.targets.example) file.\n\nThe gtest project files are generated by cmake. Use a command like this to\nrecreate the gtest project files:\n\n```\ncd msvc/x64/msvc120/gtest\ncmake -G \"Visual Studio 12 Win64\" ../../../../vendor/gtest-1.6.0 -Dgtest_force_shared_crt=ON\n```\n\n## Supported Functionality (as described in [the man page](http://mustache.github.com/mustache.5.html))\n* Variables\n* Sections\n  * False Values/Empty Lists\n  * Non-Empty-Lists\n* Inverted Sections\n* Comments\n* Partials\n* Set Delimiter\n* HTML escape syntax (triple mustaches)\n\n## TODO\n* plustache executable\n\n## Dependencies\n* boost for regex and some other things\n* google test for unit testing (included)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtazz%2Fplustache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtazz%2Fplustache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtazz%2Fplustache/lists"}