doT.py
A python implementation of the famous js template engine. doT.js. http://olado.github.io/doT/index.html. It do excetly the same thing as doT.js except written in python. Thus, it can be used in python web framework.
doT.py compile the template to a pure javascript function in server side; therefore client side can evaluate the template later without any dependency. Which means it saves the time for client to load template engine and to load template file. In short, doT.py allows using client side template tech without include a template engine in client side.
Installation
pip install doT-js-py
Here is an example:
Use client side template
<html>
<!-- load template engine -->
<script type="text/javascript" src="doT.js"></script>
<div id="container">
<script type="text/javascript">
// Compile template function
var tempFn = doT.template("<h1>Here is a sample template {{=it.foo}}</h1>");
var resultText = tempFn({foo: 'with doT'});
document.getElementById('container').innerHtml = resultText;
</script>
</html>
Use doT.py, you write:
<html>
<!-- without loading template engine -->
<div id="container">
<script type="text/javascript">
// Compile template function
var tempFn = {{ js_template('<h1>Here is a sample template {{=it.foo}}</h1>') }};
var resultText = tempFn({foo: 'with doT'});
document.getElementById('container').innerHtml = resultText;
</script>
</html>
it will automatically compiled to
<html>
<!-- without loading template engine -->
<div id="container">
<script type="text/javascript">
// Compile template function
var tempFn = function anonymous(it) { var out='"<h1>Here is a sample template '+(it.foo)+'</h1>"';return out; };
var resultText = tempFn({foo: 'with doT'});
document.getElementById('container').innerHtml = resultText;
</script>
</html>
Django Support:
Jinja2 Support:
Commandline Support:
Metadata
Release files for dot-js-py 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dot_js_py-2.0.0.tar.gz | 6.2 kB | Without provenance | Details for dot_js_py-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dot_js_py-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for dot_js_py-2.0.0-py3-none-any.whl |
Total release size: 15.8 kB
Release files / dot_js_py-2.0.0.tar.gz
| Download URL | dot_js_py-2.0.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2009d6dd68db2cd6f526fae7598c1aa7d74d51722b7ad4d253b9c1dfee90016d
|
|
BLAKE2b-256 checksum How to use checksums |
570f54d6ac86a0c32201f4b12952d2a08b288edd85dbfaae7a0c91b13f7ad143
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.11.2 Darwin/22.4.0
|
Release files / dot_js_py-2.0.0-py3-none-any.whl
| Download URL | dot_js_py-2.0.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd4b8c17cce57d9280176073fb56003b5e00c898a6417264d26235cc6b6cdf19
|
|
BLAKE2b-256 checksum How to use checksums |
0fc9ce3ba290c913e55098119268cc84493e2615a699c7881809c45a56d0a4d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.11.2 Darwin/22.4.0
|
Security for dot-js-py 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.