{"id":13671632,"url":"https://github.com/jimczj/jstemp","last_synced_at":"2025-04-27T18:31:28.815Z","repository":{"id":57286388,"uuid":"109928115","full_name":"jimczj/jstemp","owner":"jimczj","description":"a javascript template engine","archived":false,"fork":false,"pushed_at":"2017-11-11T16:48:30.000Z","size":31,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T12:56:01.465Z","etag":null,"topics":["javascript-template-engine"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jimczj.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}},"created_at":"2017-11-08T04:36:00.000Z","updated_at":"2021-06-01T03:09:45.000Z","dependencies_parsed_at":"2022-09-09T23:11:52.400Z","dependency_job_id":null,"html_url":"https://github.com/jimczj/jstemp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimczj%2Fjstemp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimczj%2Fjstemp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimczj%2Fjstemp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimczj%2Fjstemp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimczj","download_url":"https://codeload.github.com/jimczj/jstemp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187207,"owners_count":21549601,"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":["javascript-template-engine"],"created_at":"2024-08-02T09:01:15.071Z","updated_at":"2025-04-27T18:31:28.508Z","avatar_url":"https://github.com/jimczj.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# jstemp\n一个javascript模板引擎，词法分析没有使用正则表达式和其他第三方库，纯手写有穷状态机。目前支持变量替换,if\\elseif\\else表达式，for语句。暂不支持模板继承，过滤器等功能，错误处理也比较暴力，后期将继续完善。此库目前仅供练习使用，本人会将开发本库的过程写成博客记录下来，如果对这方面有兴趣，可以点star或watch。\n\n# 安装\n\n```\nnpm install jstemp --save\n```\n# 使用方法\n\n```\nvar jstemp = require('jstemp');\n// 渲染变量\njstemp.render('{{value}}', {value: 'hello world'});// hello world\n\n\n\n// 渲染if 表达式,目前if 条件表达式不支持复杂的表达式，如\u003e=,||,\u0026\u0026,后期将加强\njstemp.render('{% if value1 %}hello{% elseif value %}world{% else %}byebye{% endif %}', {value: 'hello world'});// world\n\n// 渲染列表\njstemp.render('{%for item : list %}{{item}}{%endfor%}', {list:[1, 2, 3]});// 123\n```\n# 开发笔记\n\n[不用正则表达式，用javascript从零写一个模板引擎(一)](https://github.com/jimczj/blog/issues/23)\n\n# License\nMIT License\n\nCopyright (c) 2017 jimczj\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimczj%2Fjstemp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimczj%2Fjstemp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimczj%2Fjstemp/lists"}