Skip to content

替换废弃的 l3kernel 命令#705

Merged
Liam0205 merged 3 commits intoCTeX-org:masterfrom
muzimuzhi:refacter/deprecated-func
Apr 23, 2026
Merged

替换废弃的 l3kernel 命令#705
Liam0205 merged 3 commits intoCTeX-org:masterfrom
muzimuzhi:refacter/deprecated-func

Conversation

@muzimuzhi
Copy link
Copy Markdown
Member

  • 废弃的 \char_to_utfviii_bytes:n 改写为 \codepoint_str_generate:n,后者需要 l3kernel 2022-10-09
  • 废弃的 \tl_build_get:NN 简单替换为 \tl_build_get_intermediate:NN,后者需要 l3kernel 2023-12-14

需要兼容旧版 l3kernel 吗?

Copy link
Copy Markdown
Member

@qinglee qinglee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 可以直接用 \codepoint_str_generate:n ,同时把 expl3 的版本警告提升一下
  • \tl_build_get_intermediate:NN 比较新,我倾向于用 \cs_if_exist_use:NTF 判断后使用

@muzimuzhi muzimuzhi force-pushed the refacter/deprecated-func branch 2 times, most recently from 686bcb6 to c2e0b81 Compare April 22, 2024 14:58
使用封装好的 \codepoint_str_generate:n {<codepoint>},2022-10-09 加入 l3kernel。
新命令 \tl_build_get_intermediate:NN 需要 l3kernel 2023-12-14;兼容旧版 expl3。
@muzimuzhi
Copy link
Copy Markdown
Member Author

muzimuzhi commented Apr 22, 2024

Rebase branch 顺便 squash commits,以包含 c4bd6b8 ,让我 fork 里的 CI 通过。(fork 里的 CI 由 push 触发、基于 commit/branch head,PR 里的 CI 由 pull_request 触发,基于虚拟的 merge commit。)

@muzimuzhi muzimuzhi force-pushed the refacter/deprecated-func branch from c2e0b81 to ca5d383 Compare April 22, 2024 15:57
@Liam0205
Copy link
Copy Markdown
Contributor

审查结论

代码变更合理,逻辑清晰。主要修改点:

1. ctex/ctex.dtx — 替换废弃命令 \char_to_utfviii_bytes:n

  • \codepoint_str_generate:n 替代 \char_to_utfviii_bytes:n,同时移除了不再需要的辅助函数 \ctex_utfviii_char:n\@@_utfviii_char_aux:nnnn
  • expl3 最低版本要求从 2021/02/10 提升到 2022/10/09,与新接口的引入时间匹配
  • 修改合理,新接口是官方推荐的替代方案

2. zhnumber/zhnumber.dtx — 替换废弃命令 \tl_build_get:NN

  • 使用 \cs_if_exist:NTF 做兼容分支:优先用 \tl_build_get_intermediate:NN,回退到 \use:c { tl_build_get:NN }
  • 回退分支通过 \use:c 构造控制序列,避免在开启 deprecation debug 时因旧命令被 \outer 化而无法直接使用
  • 兼容性策略得当

3. ctex/test/testfiles/zhnumber.lvt — 测试增强

  • 新增 \debug_on:n { deprecation } 确保测试覆盖废弃命令场景

CI 验证

将 PR rebase 到当前 master 后推送触发完整 CI:

  • ✅ Ubuntu — success
  • ✅ macOS — success
  • ✅ Windows — success

三平台全部通过,无回归。

LGTM,可以合并。

@Liam0205 Liam0205 merged commit 8d8bef5 into CTeX-org:master Apr 23, 2026
@muzimuzhi muzimuzhi deleted the refacter/deprecated-func branch April 23, 2026 18:32
@muzimuzhi
Copy link
Copy Markdown
Member Author

@Liam0205 AI 生成的评论,是否加个标记,如「本评论由 xx 生成,我已 review」,以示区分。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants