{"id":26000006,"url":"https://github.com/csimide/cslper","last_synced_at":"2026-03-11T13:27:17.461Z","repository":{"id":230634580,"uuid":"779739178","full_name":"csimide/cslper","owner":"csimide","description":"自用的 Typst 引用文献处理脚本（用于处理 `et al.` 和 `等`）","archived":false,"fork":false,"pushed_at":"2024-05-06T10:01:54.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-06T11:26:21.344Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csimide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-03-30T16:41:19.000Z","updated_at":"2024-05-06T11:26:22.883Z","dependencies_parsed_at":"2024-03-31T02:22:49.785Z","dependency_job_id":"9d862504-4b2c-4f4b-a2a5-5dc49258a25b","html_url":"https://github.com/csimide/cslper","commit_stats":null,"previous_names":["csimide/cslper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csimide%2Fcslper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csimide%2Fcslper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csimide%2Fcslper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csimide%2Fcslper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csimide","download_url":"https://codeload.github.com/csimide/cslper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242083199,"owners_count":20069254,"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":"2025-03-05T18:40:52.405Z","updated_at":"2026-03-11T13:27:17.411Z","avatar_url":"https://github.com/csimide.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Cslper\n\n自用的 Typst 引用文献处理脚本。\n\n在 GB/T 7714 标准中，中英文引文需要分别使用 `等` 或 `et al.` ，这一功能需要 CSL-M 扩展才能实现。Typst 使用的 CSL 解析器 [citationberg](https://github.com/typst/citationberg) 暂不支持 [CSL-M](https://citeproc-js.readthedocs.io/en/latest/csl-m/index.html) 扩展，因此需要“曲线”实现。\n\n\u003e [!NOTE]\n\u003e\n\u003e 如果使用 GB/T 7714-2015-numeric 及其衍生格式，建议使用\n\u003e https://github.com/nju-lug/modern-nju-thesis/issues/3\n\u003e 方案。此 Repo 仅保留备查。\n\n注：本 Repo 只支持编号式（引用是上标 [1] [2-3] 这种），不支持作者年份式。\n\n## 食用方法\n\n0. `git clone` 到本地。\n\n1. 安装 [Deno](https://deno.com) 。当然也可以用 Node 搭配自己喜欢的包管理器等等，需要自己改一下代码。\n\n2. 将自己的引文库导出为 CSL JSON 格式。如果是 Zotero 用户，请在 `导出文献库` 或 `导出条目` 内选择 `CSL JSON` 或 `Better CSL JSON` （若安装了 Better BibTex 插件）。\n\n3. 准备好符合要求的 CSL 格式文件，可以到 https://github.com/redleafnew/Chinese-STD-GB-T-7714-related-csl 搜寻。\n\n4. 修改 `main.ts` 内开头的两行内容，使其指向上两步中准备的文件。\n\n5. 运行 `deno convert`，会生成 `bibout.bib`。\n\n6. 到 Typst 里，使用\n\n```typst\n#bibliography(\"bibout.bib\", style: \"tab.csl\")\n```\n\n其中 `tab.csl` 是本 Repo 里的 `tab.csl` 文件。\n\n## 原理解释\n\n- `main.ts` 使用 `citation-js` 将输入文件的所有参考文献条目都按指定的 CSL 处理成符合要求的格式，作为该条目的 `title` 生成新的 bibtex 文件。使用停用词法和 `language` 字段内是否包含 `en` 来判定参考文献的语种，并选用 `et al.` 或 `等`。\n\n- `tab.csl` 是一个编号式的 CSL 引注文件，但参考文献表部分只显示 bib 中的 `title` 部分。\n\n这两者结合，相当于使用脚本生成符合要求的引注条目，再在 typst 中引用。\n\n## 附注\n\n参考 https://github.com/cherichy/BUAA-typst/blob/main/typstcite.md 。\n\n本 Repo 中 `locates-zh-CN.xml` 来自 [citation-style-language/locales@6de1dc29](https://github.com/citation-style-language/locales/blob/6de1dc298a357ef89b965c975eed967f211028c0/locales-zh-CN.xml)，采用 Creative Commons Attribution-ShareAlike 3.0 协议授权使用。原贡献者列表在此文件内。\n\n原本想 WASM 缝个 citation.js 到 typst，后来发现凑合一下也不是不能用.jpg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsimide%2Fcslper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsimide%2Fcslper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsimide%2Fcslper/lists"}