dot-js-py


Namedot-js-py JSON
Version 2.0.0 PyPI version JSON
download
home_page
SummaryA python implementation of the famous js template engine. doT.js.
upload_time2023-05-03 16:27:55
maintainer
docs_urlNone
authorlucemia
requires_python>=3.8.1,<4.0.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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
<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
<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
<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:

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dot-js-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "lucemia",
    "author_email": "lucemia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/57/0f/54d6ac86a0c32201f4b12952d2a08b288edd85dbfaae7a0c91b13f7ad143/dot_js_py-2.0.0.tar.gz",
    "platform": null,
    "description": "doT.py\n======\n\nA python implementation of the famous js template engine. doT.js. http://olado.github.io/doT/index.html.\nIt do excetly the same thing as doT.js except written in python. Thus, it can be used in python web framework.\n\ndoT.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.\n\n## Installation\n\n`pip install doT-js-py`\n\n### Here is an example:\n\n#### Use client side template\n\n```html\n<html>\n<!-- load template engine -->\n<script type=\"text/javascript\" src=\"doT.js\"></script>\n<div id=\"container\">\n<script type=\"text/javascript\">\n     // Compile template function\n     var tempFn = doT.template(\"<h1>Here is a sample template {{=it.foo}}</h1>\");\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n</script>\n</html>\n```\n\n#### Use doT.py, you write:\n```html\n<html>\n<!-- without loading template engine -->\n<div id=\"container\">\n<script type=\"text/javascript\">\n     // Compile template function\n     var tempFn = {{ js_template('<h1>Here is a sample template {{=it.foo}}</h1>') }};\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n</script>\n</html>\n```\n\n#### it will automatically compiled to\n```html\n<html>\n<!-- without loading template engine -->\n<div id=\"container\">\n<script type=\"text/javascript\">\n     // Compile template function\n     var tempFn = function anonymous(it) { var out='\"<h1>Here is a sample template '+(it.foo)+'</h1>\"';return out; };\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n</script>\n</html>\n```\n\nDjango Support:\n\nJinja2 Support:\n\nCommandline Support:\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python implementation of the famous js template engine. doT.js.",
    "version": "2.0.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fc9ce3ba290c913e55098119268cc84493e2615a699c7881809c45a56d0a4d8",
                "md5": "ce889ebfeecba2af432b97ce119af35a",
                "sha256": "cd4b8c17cce57d9280176073fb56003b5e00c898a6417264d26235cc6b6cdf19"
            },
            "downloads": -1,
            "filename": "dot_js_py-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce889ebfeecba2af432b97ce119af35a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 9555,
            "upload_time": "2023-05-03T16:27:53",
            "upload_time_iso_8601": "2023-05-03T16:27:53.049571Z",
            "url": "https://files.pythonhosted.org/packages/0f/c9/ce3ba290c913e55098119268cc84493e2615a699c7881809c45a56d0a4d8/dot_js_py-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "570f54d6ac86a0c32201f4b12952d2a08b288edd85dbfaae7a0c91b13f7ad143",
                "md5": "3ef7696991e9aaa8c2711f452d33ba07",
                "sha256": "2009d6dd68db2cd6f526fae7598c1aa7d74d51722b7ad4d253b9c1dfee90016d"
            },
            "downloads": -1,
            "filename": "dot_js_py-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3ef7696991e9aaa8c2711f452d33ba07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 6196,
            "upload_time": "2023-05-03T16:27:55",
            "upload_time_iso_8601": "2023-05-03T16:27:55.473398Z",
            "url": "https://files.pythonhosted.org/packages/57/0f/54d6ac86a0c32201f4b12952d2a08b288edd85dbfaae7a0c91b13f7ad143/dot_js_py-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-03 16:27:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dot-js-py"
}
        
Elapsed time: 0.06087s