2. Overview of principles
2.1. Template-based content generation
The block diagram below illustrates a fairly standard process of generating a text content from the template using values defined in the input data.
+----------+ +------------+
| template | | input data |
+----------+ +------------+
| |
V V
+-----------------------+
| Python filling script |
| using blockie module |
+-----------------------+
|
V
+-------------------+
| generated content |
+-------------------+
Blockie templates are logicless, so they do not contain any script-like command elements. Instead, the logic of filling the template can be defined purely by the structure of template elements and input data. Alternatively, the Python filling script can use low-level functions provided by Blockie to precisely control the content generation.
2.3. Template filling
Blocks in the template (including the whole template) can be loaded into the Block
objects to fill the template with data, i.e., to perform operations with template blocks and
variables in order to generate an output content.
Blockie provides two ways of filling the template:
Data-driven approach that uses the structure and content of the input data to control the template filling process. This method is suitable for most use cases and is generally more user-friendly.
Manual process allowing to perform low-level operations and also implement custom extension-like features in form of a Python script using low-level functions provided by Blockie at the cost of higher complexity.