Templator

Simple, elegant Python based web templating (part of web.py). If you are familiar with Python, there is no new syntax to learn.
This is a stand-alone version of templator.

Usage

Clone the templaltor package into your project and add:

from templator import template

Then add e.g.:

template_globals = {  
    "str": str,  
    "json": json,  
    "time": time,  
    "my_function": my_function, #  you can pass your own functions to templator.  
}

Then add e.g.:

page_render = template.render("<templates folder>", globals=template_globals, <base="page_base">)

Then, for example, in cherrypy:

class My_project(object):
    """
    Base class for project pages
    """

    @cherrypy.expose
    def my_page(self, <param-1>): 
        <param-2 = "some text">
        <param-3 = some_value>
        return str(page_render.my_page(<param-1, param-2, param-3, other_var, etc>)   
        # be sure to return a string, my_page == template file.

See the web.py templator documentation for details on setting up a template file.

You can read the documentation at:

https://webpy.readthedocs.io/en/latest/templating.html

GitHub - Dan-in-CA/templator at pythonawesome.com
A simple, elegant Python based web templating engine (part of web.py). - GitHub - Dan-in-CA/templator at pythonawesome.com