FastTemp is a simple, fast, and lightweight template engine for Python. It is still in development, and not ready for production use.
FastTemp is designed to be fast and easy to use. It has a rich syntax and supports many features. It's syntax highly inspired by blade from Laravel. We use the similar syntax to blade, but different in some ways. We are not trying to copy blade, but we are trying to make a template engine with a similar syntax to blade which is easy to use and fast. We are also trying to make it as lightweight as possible.
-
Variables
Syntax Description @set(variable, value)
Set a variable {variable}
Print the variable {% variable %}
Print the variable with HTML escaped -
Comments
Syntax Description @comment ... @endcomment
Comment block -
Control Structures
Syntax Description @if(condition) ... @endif
If statement @if(condition) ... @else ... @endif
If-else statement @unless ... @endunless
Unless statement -
Loops
Syntax Description @for ... @endfor
For loop @foreach ... @endforeach
For-each loop @while ... @endwhile
While loop -
Includes
Syntax Description @include ...
Include a template -
Layouts
Syntax Description @extends ...
Extend a template @section ... @endsection
Define a section @yield ...
Yield a section @parent
Yield the parent section -
Built-in Directives
-
Built-in Functions
-
Built-in Filters
-
Built-in Tags
-
Custom Directives
-
Custom Functions
-
Custom Filters
-
Custom Tags