/0000000 /000000 /000000/0000 /000000
/00_____/ /00__ 00| 00_ 00_ 00 /00__ 00
| 00 | 00 \ 00| 00 \ 00 \ 00| 00 \ 00
| 00 | 00 | 00| 00 | 00 | 00| 00 | 00
| 0000000| 000000/| 00 | 00 | 00| 0000000/
\_______/ \______/ |__/ |__/ |__/| 00____/
| 00
| 00
|__/
About
comp is a Python functional style component system based in jinja, presenting type safety through an intensive use of typed.
Overview
With comp you can construct components, which are typed functions (in the sense of typed) returning jinja strings (i.e, strings presenting a valid jinja syntax), constituting a type COMPONENT.
Components (i.e, instances of COMPONENT) have the structure determined by models (in the sense of typed). Furthermore, they can be composed through four component operations (join, concat, eval and copy), which corresponds, respectively, to certain magic methods in COMPONENT. This allow us to create derived components from primitive components by making use of component equations.
After constructed, components can be rendered into raw HTML strings by making use of the render service function. To render a component we need to pass a context, which is the minimum information needed to provide a sense to the component. This could include, for example, markdown content (which is rendered through python-markdown), rst content (rendered via docutils), other components, and so on. This flexibility allows the use of comp in both dynamic and static environments.
Components can also be previewed by putting them into a preview stack.
Install
With pip:
pip install git+https://github.com/ximenesyuri/comp
With py:
py i ximenesyuri/comp
Code
The code is available at the Github repository ximenesyuri/comp.