Inja is a template engine for modern C++, loosely inspired by jinja for python. It has an easy and yet powerful template syntax with all variables, loops, conditions, includes, callbacks, and comments you need, nested and combined as you like. Inja uses the wonderful json library by nlohmann for data input. Most importantly, inja needs only two header files, which is (nearly) as trivial as integration in C++ can get. Of course, everything is tested on all relevant compilers. Inja is a headers only library, which can be downloaded from the releases or directly from the include/ or single_include/ folder. Inja uses nlohmann/json.hpp as its single dependency, so make sure it can be included from inja.hpp. json can be downloaded here.

Features

  • The basic template rendering takes a template as a std::string and a json object for all data. It returns the rendered template as an std::string
  • If you are using the Meson Build System, then you can wrap this repository as a subproject
  • Conditions support the typical if, else if and else statements
  • A few functions are implemented within the inja template syntax
  • You can create your own and more complex functions with callbacks
  • Template inheritance allows you to build a base skeleton template that contains all the common elements and defines blocks that child templates can override

Project Samples

Project Activity

See All Activity >

Categories

JSON

License

MIT License

Follow Inja

Inja Web Site

Other Useful Business Software
Go from Data Warehouse to Data and AI platform with BigQuery Icon
Go from Data Warehouse to Data and AI platform with BigQuery

Build, train, and run ML models with simple SQL. Automate data prep, analysis, and predictions with built-in AI assistance from Gemini.

BigQuery is more than a data warehouse—it's an autonomous data-to-AI platform. Use familiar SQL to train ML models, run time-series forecasts, and generate AI-powered insights with native Gemini integration. Built-in agents handle data engineering and data science workflows automatically. Get $300 in free credit, query 1 TB, and store 10 GB free monthly.
Try BigQuery Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Inja!

Additional Project Details

Programming Language

C++

Related Categories

C++ JSON Software

Registered

2023-10-12