Declassed Art: Clabate: minimalistic class-based templates for Python :

Declassed Art: Clabate: minimalistic class-based templates for Python
by:
blow post content copied from  Planet Python
click here to view original post


Clabate is a minimalistic template system for Python language.

Clabate does not offer yet another mini-language for templates. It is based on class inheritance and PEP 3101 string formatting.

The basic idea is simple: declare template strings as class attributes and render them in the right order in some container called context.

Subclasses may re-define template strings and define new ones.

Dynamic content can be generated using class properties and values passed as kwargs to the constructor and/or render method.

In the very basic layer Clabate implements bare textual templates which can be used, for example, to generate configuration files.

And that basic layer is extended by MarkupTemplate, which escapes everything by default, trying to minimize chances to overlook unescaped substitutions.


December 09, 2022 at 05:30AM
Click here for more details...

=============================
The original post is available in Planet Python by
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce