SOAT (template engine)
| Original author(s) | Adnan Yunus |
|---|---|
| Stable release | 0.7.15
/ August 21, 2018[1] |
| Written in | Python |
| Engine | |
| Type | Template engine |
| License | BSD License |
Search SOAT (template engine) on Amazon.
SOAT is a template engine for the Python programming language and is licensed under a BSD License created by Adnan Yunus. It is similar to the Django template engine but provides Python expressions. It is a text-based template language and thus can be used to generate any markup as well as source code.
The SOAT template engine allows customization of delimiters similar to Mustache_(template_system). Because it is merely a thin wrapper over the Python language, full language features such as functions are available within a template.
Features
Some of the unique features of SOAT are:[2]
- Delimiter changing
- One to many output buffers or files
- Template inheritance (using Python import)
- Compiles down to the optimal Python code just in time
- Optional ahead-of-time template compilation
- Easy to debug. Line numbers of exceptions directly point to the correct line in the template.
- Configurable syntax
Example
Here is a small example of a template file 'example.cxx.soa'
#include <iostream>
int main(int argc, char *argv[]) {
printf("{{name}}");
}Given a Python dict data={'name': 'Hello world'}, this produces the C++ string:
#include <iostream>
int main(int argc, char *argv[]) {
printf("Hello world");
}Sources
- ↑ "artometa/soat". GitHub.
- ↑ "artometa/soat". GitHub.
External links
- SOAT website
- SOAT on Python pypi
- soat on GitHub
This article "SOAT (template engine)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:SOAT (template engine). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
