{"id":14065490,"url":"https://github.com/hoishing/kTemplate","last_synced_at":"2025-07-29T20:32:50.091Z","repository":{"id":65448659,"uuid":"586129518","full_name":"hoishing/kTemplate","owner":"hoishing","description":"a minimalist python html template","archived":false,"fork":false,"pushed_at":"2023-03-06T01:44:04.000Z","size":742,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-15T01:03:44.417Z","etag":null,"topics":["python","template"],"latest_commit_sha":null,"homepage":"https://hoishing.github.io/kTemplate","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/hoishing.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2023-01-07T03:19:32.000Z","updated_at":"2024-05-28T01:36:34.872Z","dependencies_parsed_at":"2024-05-28T01:50:30.960Z","dependency_job_id":null,"html_url":"https://github.com/hoishing/kTemplate","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"1e2712fec4cc0a742b844f0e38e7539ead03f834"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoishing%2FkTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoishing%2FkTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoishing%2FkTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoishing%2FkTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoishing","download_url":"https://codeload.github.com/hoishing/kTemplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228046155,"owners_count":17861101,"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":["python","template"],"created_at":"2024-08-13T07:04:31.180Z","updated_at":"2024-12-04T04:31:11.338Z","avatar_url":"https://github.com/hoishing.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# kTemplate\n\n[![ci-badge]][ci-url] [![pypi-badge]][pypi-url] [![MIT-badge]][MIT-url] [![black-badge]][black-url]\n\n\u003e a minimalist python html template\n\n- [docs]\n\n## Quick Start\n\n### Installation\n\n`pip install kTemplate`\n\n### Examples\n\n```python\nfrom kTemplate import (\n  div, img, # common html elements\n  element   # for creating custom element\n)\n\n# create common html element\n# `class` represents by `cls` due to python keyword\nhtml_str = div(img(src='url'), cls='bar')\n# \u003cdiv class=\"bar\"\u003e\u003cimg src=\"url\"/\u003e\u003c/div\u003e\n\n# create custom element\nmy_element = element(tag=\"MyElement\", content=\"foo\" props=\"bar\")\n# \u003cMyElement props=\"ar\"\u003efoo\u003c/MyElement\u003e\n```\n\nsee also: how to create [templates and components]\n\n## Motivation\n\nWhen creating simple website, instead of seperating python and template files like this:\n\n```html\n\u003cul id=\"navigation\"\u003e\n  {% for item in navigation %}\n  \u003cli\u003e\u003ca href=\"{{ item.href }}\"\u003e{{ item.caption }}\u003c/a\u003e\u003c/li\u003e\n  {% endfor %}\n\u003c/ul\u003e\n```\n\nI prefer a pure python approach like this:\n\n```python\nul(\n  id = \"navigation\",\n  content = [\n    li(\n      a(item.caption, href=item.href)\n    )\n    for item in navigation\n  ]\n)\n```\n\nIt provides full intellisense, type checking, and all language supports from the text editor. I feel a better DX with this approach.\n\n## Need Help?\n\nOpen a [github issue] or ping me on [Twitter ![twitter-icon]][Twitter]\n\n[github issue]: https://github.com/hoishing/kTemplate/issues\n[Twitter]: https://twitter.com/hoishing\n[twitter-icon]: https://api.iconify.design/logos/twitter.svg?width=20\n[ci-badge]: https://github.com/hoishing/kTemplate/actions/workflows/ci.yml/badge.svg\n[ci-url]: https://github.com/hoishing/kTemplate/actions/workflows/ci.yml\n[MIT-badge]: https://img.shields.io/github/license/hoishing/kTemplate\n[MIT-url]: https://opensource.org/licenses/MIT\n[pypi-badge]: https://img.shields.io/pypi/v/ktemplate\n[pypi-url]: https://pypi.org/project/ktemplate/\n[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg\n[black-url]: https://github.com/psf/black\n[templates and components]: https://hoishing.github.io/kTemplate/usage/#templates-and-components\n[docs]: https://hoishing.github.io/kTemplate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoishing%2FkTemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoishing%2FkTemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoishing%2FkTemplate/lists"}