{"id":13407372,"url":"https://github.com/lucemia/doT","last_synced_at":"2025-03-14T12:30:58.881Z","repository":{"id":8315509,"uuid":"9863649","full_name":"lucemia/doT","owner":"lucemia","description":"A python implementation of doT.js","archived":false,"fork":false,"pushed_at":"2023-05-03T16:09:18.000Z","size":36,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T20:27:13.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucemia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-05-05T03:33:21.000Z","updated_at":"2022-10-26T02:46:15.000Z","dependencies_parsed_at":"2024-10-26T03:22:22.998Z","dependency_job_id":"af9d22da-2264-4c47-96e8-9b6d7c45a9cb","html_url":"https://github.com/lucemia/doT","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucemia%2FdoT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucemia%2FdoT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucemia%2FdoT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucemia%2FdoT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucemia","download_url":"https://codeload.github.com/lucemia/doT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243577711,"owners_count":20313691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:00:38.705Z","updated_at":"2025-03-14T12:30:58.499Z","avatar_url":"https://github.com/lucemia.png","language":"Python","readme":"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\u003chtml\u003e\n\u003c!-- load template engine --\u003e\n\u003cscript type=\"text/javascript\" src=\"doT.js\"\u003e\u003c/script\u003e\n\u003cdiv id=\"container\"\u003e\n\u003cscript type=\"text/javascript\"\u003e\n     // Compile template function\n     var tempFn = doT.template(\"\u003ch1\u003eHere is a sample template {{=it.foo}}\u003c/h1\u003e\");\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n\u003c/script\u003e\n\u003c/html\u003e\n```\n\n#### Use doT.py, you write:\n```html\n\u003chtml\u003e\n\u003c!-- without loading template engine --\u003e\n\u003cdiv id=\"container\"\u003e\n\u003cscript type=\"text/javascript\"\u003e\n     // Compile template function\n     var tempFn = {{ js_template('\u003ch1\u003eHere is a sample template {{=it.foo}}\u003c/h1\u003e') }};\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n\u003c/script\u003e\n\u003c/html\u003e\n```\n\n#### it will automatically compiled to\n```html\n\u003chtml\u003e\n\u003c!-- without loading template engine --\u003e\n\u003cdiv id=\"container\"\u003e\n\u003cscript type=\"text/javascript\"\u003e\n     // Compile template function\n     var tempFn = function anonymous(it) { var out='\"\u003ch1\u003eHere is a sample template '+(it.foo)+'\u003c/h1\u003e\"';return out; };\n     var resultText = tempFn({foo: 'with doT'});\n     document.getElementById('container').innerHtml = resultText;\n\u003c/script\u003e\n\u003c/html\u003e\n```\n\nDjango Support:\n\nJinja2 Support:\n\nCommandline Support:\n","funding_links":[],"categories":["Lib/Framework/API/Dev Tool"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucemia%2FdoT","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucemia%2FdoT","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucemia%2FdoT/lists"}