{"id":16932856,"url":"https://github.com/zrr1999/bonelate","last_synced_at":"2026-04-24T16:32:16.067Z","repository":{"id":89251308,"uuid":"361437521","full_name":"zrr1999/bonelate","owner":"zrr1999","description":"Bonelate 是一个基于 pyparsing 针对 LaTeX 的 mustache 模版语言变种的实现。","archived":false,"fork":false,"pushed_at":"2023-12-04T17:49:29.000Z","size":81,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-24T05:48:59.870Z","etag":null,"topics":["latex","mustache","pyparsing","python","python-library"],"latest_commit_sha":null,"homepage":"","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/zrr1999.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":"2021-04-25T13:34:02.000Z","updated_at":"2023-04-04T16:11:40.000Z","dependencies_parsed_at":"2025-04-05T14:37:07.379Z","dependency_job_id":null,"html_url":"https://github.com/zrr1999/bonelate","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zrr1999/bonelate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zrr1999%2Fbonelate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zrr1999%2Fbonelate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zrr1999%2Fbonelate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zrr1999%2Fbonelate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zrr1999","download_url":"https://codeload.github.com/zrr1999/bonelate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zrr1999%2Fbonelate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["latex","mustache","pyparsing","python","python-library"],"created_at":"2024-10-13T20:47:50.236Z","updated_at":"2026-04-24T16:32:16.062Z","avatar_url":"https://github.com/zrr1999.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bonelate\n\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\nBonelate 是一个针对 LaTeX 的轻逻辑模版解析引擎，类似于 mustache。\n与采取 mustache 的其他模版解析引擎相比（例如chevron或pymustache），\nBonelate 针对 LaTeX 的语法做了很多优化，使 LaTeX 模板文件在不渲染的情况下也可使用 LaTeX 工具编译通过。\n\n## 优势\n\nBonelate 针对 LaTeX 的语法设计了模板标记符，\n使用 LaTeX 中非特殊字符作为标记符，例如`{{!partial}}`中的`!`，\n从而在不解析渲染的情况下直接通过 LaTeX 引擎编译也不会报错。\n\n## 安装 [![Downloads](https://pepy.tech/badge/bonelate)](https://pepy.tech/project/bonelate)\n\n这个项目使用 [Python](https://www.python.org/downloads/) 开发，请确保你本地安装了它。\n\n使用PyPI安装\n\n```shell\n$ pip install bonelate[all]\n```\n\n源码安装\n\n```shell\n$ git clone git@gitee.com:zrr1999/bonelate.git\n$ cd bonelate\n$ pip install .\n```\n\n## 使用说明\n### 支持语法\n1. 模板变量渲染 `{{keyName}}`\n2. 模板块渲染 `{{!keyName}}sth.{{/keyName}}`\n以!开始、以/结束表示模板块，它会根据当前上下文中的键值来对区块进行一次或多次渲染。\n它的功能很强大，有类似if、foreach的功能。\n3. 失效渲染`{{?keyName}} {{/keyName}}`\n该语法与模板块渲染类似，不同在于它是当keyName值为空或否定值时才渲染输出该区块内容。\n3. 视图渲染 `{{.}}`\n可以循环输出整个数组。\n\n### 简单示例\n\n运行如下代码\n```python\nfrom bonelate import render, parse\n\ntest_string = r\"\\LaTeX{} is a {{var}} typesetting system.{{!vars}}.{{/vars}}\"\nprint(render(test_string, {\n    \"var\": \"high-quality\",\n    \"vars\": range(10),\n}))\n```\n\n得到渲染结果\n```latex\n\\LaTeX{} is a high-quality typesetting system...........\n```\n\n\n### 命令行示例\n\n如果你的环境变量中有 python 脚本目录，你可以使用\n\n```shell\n$ bonelate render ./examples/ml_work\n```\n\n如果没有的话，你需要使用如下命令\n\n```shell\n$ python bonelate render ./examples/ml_work\n```\n\n## 更新日志\n\n#### 0.1.2 (2021.5.14)\n\n1. 优化了插件接口。\n2. 修复了无法解析嵌套模板的问题。\n3. 修改了render指令用法\n\n#### 0.1.1 (2021.5.5)\n1. 完善了README中的用法描述。\n2. 增加了分隔符特性，{{var:sep}}。\n3. 遍历渲染改为判断对象是否为Iterable。\n4. 添加了用于处理Sympy公式的插件。\n5. 修复部分bug。\n\n#### 0.1.0 (2021.5.2)\n1. 重构 tokenizer，现在命名为parser。\n2. 增加了 partial 语法。\n3. 增加了 docs 目录。\n4. 增加了更多例子。\n5. 修改了单元测试。\n\n#### 0.0.2 (2021.4.29)\n1. 不再兼容mustache语法。\n2. 增加了命令行指令。\n3. 增加了更多例子。\n4. 添加了单元测试（不完全）。\n5. 修复了大括号内的内容不能正常解析的问题。\n6. 修复了模板变量中含有空白符不能正常解析的问题。\n\n\n## 维护者\n\n[@六个骨头](https://gitee.com/zrr1999)\n\n## 如何贡献\n\n非常欢迎你的加入！[提一个 Issue](https://github.com/zrr1999/bonelate/issues/new) 或者提交一个 Pull Request。\n\n### 贡献者\n\n感谢以下参与项目的人：\n\n## 使用许可\n[MIT](LICENSE) © Rongrui Zhan","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzrr1999%2Fbonelate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzrr1999%2Fbonelate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzrr1999%2Fbonelate/lists"}