{ "info": { "author": "Paul Sokolovsky", "author_email": "pfalcon@users.sourceforge.net", "bugtrack_url": null, "classifiers": [], "description": "utemplate\n=========\n\n`utemplate` is a lightweight and memory-efficient template engine for\nPython, primarily intended for use with Pycopy, a lightweight Python\nimplementation (https://github.com/pfalcon/pycopy).\n\n`utemplate` syntax is roughly based on Django/Jinja2 syntax (e.g.\n`{% if %}`, `{{var}}`), but only the most needed features are offered\n(for example, \"filters\" are syntactic sugar for function calls, and\nso far are not planned to be implemented).\n\n`utemplate` compiles templates to Python source code, specifically to\na generator function which, being iterated over, produces consecutive\nparts (substrings) of a rendered template. This allows for minimal\nmemory usage during template substitution (with Pycopy, it starts\nfrom mere hundreds of bytes). Generated Python code can be imported as\na module directly, or a simple loader class is provided for convenience.\nThere is also a loader class which will compile templates on the fly,\nif not already compiled (currently not automatically recompiled if\nchanged, this is on TODO).\n\nTo test/manage templates, `utemplate_util.py` tool is provided. For\nexample, to quickly try a template (assuming you are already in\n`examples/` dir):\n\n micropython ../utemplate_util.py run squares.tpl\n\nor\n\n python3 ../utemplate_util.py run squares.tpl\n\nTemplates can take parameters (that's how dynamic content is generated).\nTemplate parameters are passed as arguments to a generator function\nproduced from a template. They also can be passed on the `utemplate_util.py`\ncommand line (arguments will be treated as strings in this case, but\ncan be of any types if called from your code):\n\n micropython ../utemplate_util.py run test1.tpl foo bar\n\nQuick Syntax Reference\n----------------------\n\nEvaluating Python expression, converting it to a string and outputting to\nrendered content:\n\n* `{{}}`\n\nWhere `expr` is an arbitrary Python expression - from a bare variable name,\nto function calls, `yield from`, `await` expressions.\n\nSupported statements:\n\n* `{% if %}`, `{% elif %}`, `{% else %}`, `{% endif %}` - the usual \"if\"\n statement\n* `{% for %}`, `{% endfor %}` - the usual \"for\" statement\n* `{% while %}`, `{% endwhile %}` - the usual \"while\" statement\n* `{% args var1, var2, ... %}` - specify arguments to a template\n* `{% set var = expr %}` - assignment statement\n* `{% include \"name.tpl\" %}` - statically include another template\n* `{% include {{name}} %}` - dynamically include template whose name is\n stored in variable `name`.\n\nNaming Conventions\n------------------\n\nThe current conventions (may be adjusted in the future):\n\n* The recommended extension for templates is `.tpl`, e.g. `example.tpl`.\n* When template is compiled, dot (`.`) in its name is replaced\n with underscore (`_`) and `.py` appended, e.g. `example_tpl.py`. It\n thus can be imported with `import example_tpl`.\n* The name passed to `{% include %}` statement should be full name of\n a template with extension, e.g. `{% include \"example.tpl\" %}`.\n* For dynamic form of the `include`, a variable should similarly contain\n a full name of the template, e.g. `{% set name = \"example.tpl\" %}` /\n `{% include {{name}} %}`.\n\nExamples\n--------\n\n`examples/squares.tpl` as mentioned above has following content:\n\n```\n{% for i in range(5) %}\n| {{i}} | {{\"%2d\" % i ** 2}} |\n{% endfor %}\n```\n\nMore examples are available in [examples/](examples/) directory.\n\nIf you want to see a complete example web application which uses utemplate,\nrefer to https://github.com/pfalcon/notes-pico .\n\nLicense\n-------\n\n`utemplate` is written and maintained by Paul Sokolovsky. It's available\nunder the MIT license.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pfalcon/utemplate", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "utemplate", "package_url": "https://pypi.org/project/utemplate/", "platform": "", "project_url": "https://pypi.org/project/utemplate/", "project_urls": { "Homepage": "https://github.com/pfalcon/utemplate" }, "release_url": "https://pypi.org/project/utemplate/1.3.1/", "requires_dist": null, "requires_python": "", "summary": "Very lightweight, memory-efficient, dependency-free template engine (compiles to Python source).", "version": "1.3.1" }, "last_serial": 5563549, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "420f9cd48814eb9fb410b937e8f47027", "sha256": "652fde6eb15dd2dcdaa8cc2ad8e8dd86859f56f0d9cc0a00107aa958ff598c7a" }, "downloads": -1, "filename": "utemplate-0.9.tar.gz", "has_sig": false, "md5_digest": "420f9cd48814eb9fb410b937e8f47027", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3108, "upload_time": "2015-06-27T19:54:20", "url": "https://files.pythonhosted.org/packages/a9/3c/459213aafc66db142315ddd764469a32df7f2cf608cccb1d9e14347681a6/utemplate-0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "6cb767a756b6980d5d6ad69edd9499d8", "sha256": "47da4e66167a31ea2998a233aa4d552714745e8757f3a408fd59992e1b479664" }, "downloads": -1, "filename": "utemplate-0.9.1.tar.gz", "has_sig": false, "md5_digest": "6cb767a756b6980d5d6ad69edd9499d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3106, "upload_time": "2015-06-27T22:27:06", "url": "https://files.pythonhosted.org/packages/fa/82/7f0bca9b77837e99fcb7dd6eb8bd2be01d9a45eda978ce3ac6f4194748c6/utemplate-0.9.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "a704bf612474c07c36ad50363d576882", "sha256": "2ff7d83f9d7ae5cd1777993288d332b05986c5753389ce74dbae4f86313e3d5e" }, "downloads": -1, "filename": "utemplate-1.0.tar.gz", "has_sig": false, "md5_digest": "a704bf612474c07c36ad50363d576882", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2121, "upload_time": "2017-02-05T15:12:05", "url": "https://files.pythonhosted.org/packages/1a/83/1734297f66b82f1c58f6638adac46fc1112adcfe305bf62f212f01888c78/utemplate-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "9313c1dc078263726baeb0c2b36e154e", "sha256": "c2e6c1c5dc1b9a6afd22f0e8f65c164709942132977b0ff93028ff8c1594ba9d" }, "downloads": -1, "filename": "utemplate-1.1.tar.gz", "has_sig": false, "md5_digest": "9313c1dc078263726baeb0c2b36e154e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2143, "upload_time": "2017-04-29T14:11:19", "url": "https://files.pythonhosted.org/packages/b5/ff/caf395bd78bf65a4ad16217f9959663d46855b5d606cb13cd2f3756b5d2f/utemplate-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "2221ae22b2665ec5b5b2aeae427f012e", "sha256": "b956ef70381849bc0dc186e0dbe24c8638c514f8b734bb0d499bcfe34ae1f145" }, "downloads": -1, "filename": "utemplate-1.2.tar.gz", "has_sig": false, "md5_digest": "2221ae22b2665ec5b5b2aeae427f012e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2216, "upload_time": "2018-02-10T13:45:26", "url": "https://files.pythonhosted.org/packages/ce/c3/6ef0cc5c256c2192d8f6ff0175a6b6c3dff727fdb6ec1eb432fc0a2a97e9/utemplate-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "d44751a6b0f5358e2a8c0899f0538efc", "sha256": "e5a4fb7704986434a95d0e18d7009e413efda7a20590bada14f342188fc56b9b" }, "downloads": -1, "filename": "utemplate-1.3.tar.gz", "has_sig": false, "md5_digest": "d44751a6b0f5358e2a8c0899f0538efc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3843, "upload_time": "2019-06-12T06:53:38", "url": "https://files.pythonhosted.org/packages/72/e7/7379e4b6649b9d9d5527c6f9f9eb44db5cb947b0d6a3ee0777bce12107c4/utemplate-1.3.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "ea323cb02ddf951e9e1543792a260988", "sha256": "467edbcfaa82b550ca24bbe0cd6fa09b80649fbbc4c0b70028eb7014a1bba036" }, "downloads": -1, "filename": "utemplate-1.3.1.tar.gz", "has_sig": false, "md5_digest": "ea323cb02ddf951e9e1543792a260988", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3850, "upload_time": "2019-07-21T14:22:53", "url": "https://files.pythonhosted.org/packages/75/11/59ac69a862232afc9ffc1cadcc95395cfb7b28c17610edc061039d4f03f8/utemplate-1.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea323cb02ddf951e9e1543792a260988", "sha256": "467edbcfaa82b550ca24bbe0cd6fa09b80649fbbc4c0b70028eb7014a1bba036" }, "downloads": -1, "filename": "utemplate-1.3.1.tar.gz", "has_sig": false, "md5_digest": "ea323cb02ddf951e9e1543792a260988", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3850, "upload_time": "2019-07-21T14:22:53", "url": "https://files.pythonhosted.org/packages/75/11/59ac69a862232afc9ffc1cadcc95395cfb7b28c17610edc061039d4f03f8/utemplate-1.3.1.tar.gz" } ] }