Skip to content

Commit 8e2d20b

Browse files
Merge pull request #707 from YDX-2147483647/split
拆分`bithesis.dtx`到`src/bithesis*.dtx`
2 parents 2c22332 + f365713 commit 8e2d20b

23 files changed

+2541
-2496
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
.github/tl_packages
2020
- uses: taiki-e/install-action@v2
2121
with:
22-
tool: fd-find
22+
tool: fd-find, just
2323

2424
- name: Restore Microsoft fonts cache
2525
id: microsoft-fonts
@@ -45,7 +45,7 @@ jobs:
4545
# 目前发布正式版时,会手动提升版本号
4646
run: python scripts/update_version.py
4747

48-
- run: make doc handbooks
48+
- run: just doc handbooks
4949

5050
- name: Upload bithesis.pdf for later usage.
5151
uses: actions/upload-artifact@v6
@@ -100,7 +100,7 @@ jobs:
100100
- uses: actions/checkout@v6
101101
- uses: taiki-e/install-action@v2
102102
with:
103-
tool: fd-find
103+
tool: fd-find, just
104104
- name: Download bithesis.pdf
105105
uses: actions/download-artifact@v7
106106
with:
@@ -112,7 +112,7 @@ jobs:
112112
- name: Copy manual to the template folder.
113113
run: |
114114
mv bithesis.pdf ./templates/${{ matrix.template }}
115-
make copy-only
115+
just copy-only
116116
- name: Install zip
117117
uses: montudor/action-zip@v1
118118
- name: Zip files under ./${{ matrix.template }}
@@ -217,9 +217,11 @@ jobs:
217217
name: Upload to CTAN
218218
runs-on: ubuntu-latest
219219
needs: build
220-
if: ${{ ! github.event.release.prerelease }}
221220
steps:
222221
- uses: actions/checkout@v6
222+
- uses: taiki-e/install-action@v2
223+
with:
224+
tool: just
223225
- name: Download bithesis.pdf
224226
uses: actions/download-artifact@v7
225227
with:
@@ -229,7 +231,11 @@ jobs:
229231
with:
230232
name: handbooks
231233
path: handbook
232-
- run: make pkg-only
234+
- run: just pkg-only
235+
- uses: actions/upload-artifact@v6
236+
with:
237+
name: ctan-pkg
238+
path: bithesis.zip
233239
- name: Determine version
234240
id: version
235241
run: |
@@ -238,6 +244,7 @@ jobs:
238244
echo "date=$(date '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
239245
- name: Upload to CTAN
240246
uses: paolobrasolin/ctan-submit-action@v1
247+
if: ${{ ! github.event.release.prerelease }}
241248
with:
242249
action: upload
243250
file_path: bithesis.zip
@@ -249,6 +256,7 @@ jobs:
249256
email: bithesis@bitnp.net
250257
uploader: Feng Kaiyu
251258
- name: Report
259+
if: ${{ ! github.event.release.prerelease }}
252260
run: >
253261
echo "🎉 Successfully upload
254262
${{ steps.version.outputs.number }} (${{ steps.version.outputs.date }})

.github/workflows/test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Test
22

3-
on:
3+
on:
44
push:
55
branches:
66
- main
@@ -27,7 +27,7 @@ jobs:
2727
${{ matrix.tl-version < 2024 && '.github/tl_packages_compat' || '' }}
2828
- uses: taiki-e/install-action@v2
2929
with:
30-
tool: fd-find, ripgrep
30+
tool: fd-find, ripgrep, just
3131

3232
- name: Restore Microsoft fonts cache
3333
id: microsoft-fonts
@@ -48,7 +48,7 @@ jobs:
4848
ln -s $(kpsewhich -var-value=TEXMFDIST)/fonts/ ~/.fonts/texmf-dist-fonts
4949
fc-cache
5050
51-
- run: ${{ matrix.tl-version < 2025 && 'TEST_SKIP_DOC="1"' || '' }} make test
51+
- run: ${{ matrix.tl-version < 2025 && 'TEST_SKIP_DOC="1"' || '' }} just test
5252

5353
check-latex:
5454
runs-on: ubuntu-latest
@@ -63,9 +63,9 @@ jobs:
6363
expltools
6464
- uses: taiki-e/install-action@v2
6565
with:
66-
tool: fd-find
67-
- run: make cls
68-
- run: make check
66+
tool: fd-find, just
67+
- run: just cls
68+
- run: just check
6969

7070
check_typos:
7171
runs-on: ubuntu-latest

.gitignore

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,30 +280,21 @@ TSWLatexianTemp*
280280
# Makeindex log files
281281
*.lpz
282282

283-
node_modules
284-
wiki/.vuepress/dist
285-
bithesis.zip
286-
bithesis
283+
# Cache directory for various scripts
284+
/target/
287285

288-
# Generated by `make copy`
286+
# Generated by `just copy`
289287
/templates/*/latexmkrc
290288
/tests/*/latexmkrc
291289
/tests/**/*.jpg
292290
/handbook/latexmkrc
293291

294-
# Used by `make copy`
295-
!assets/bit_*.pdf
292+
# Used by `just copy`
293+
!/assets/bit_*.pdf
296294

297-
# Generated by `make assets/faq.tex`
298-
/assets/faq.tex
299-
300-
overleaf
301-
*.zip
302-
303-
/scripts/cache/
295+
# Generated by `/src/Makefile`
296+
/src/assets/faq.tex
304297

305298
.DS_Store
306299

307-
BIT-bithesis-graduates*
308-
309300
.lycheecache

DEVELOPMENT.md

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,53 @@
1313

1414
例:改进`ref.bib`中的示例,在 `main.tex` 中补充注释。
1515

16-
- 修改 `bithesis.dtx` 文件
16+
- 修改 `bithesis*.dtx` 文件
1717

1818
例:添加新命令,更改 `\BITSetup` 选项。
1919

2020
- 修改其他文件。
2121

2222
> [!TIP]
2323
>
24-
> 运行 Makefile 需要[安装 fd](https://github.com/sharkdp/fd/#installation),通常下载可执行文件即可。此外 Windows 开发者若遇到问题,请参考[后文](#Windows)
24+
> 运行 justfile(及 Makefile)需要安装 [just](https://just.systems/man/en/pre-built-binaries.html)[fd](https://github.com/sharkdp/fd/#installation),通常下载可执行文件即可。此外 Windows 开发者若遇到问题,请参考[后文](#Windows)
2525
2626
### 修改 `templates/` 中某个模板
2727

2828
如果改动仅仅涉及某个模板,那么相对简单一些:
2929

30-
1. 初次开发前,运行 `make copy`,这会生成 `*.cls` 等并更新到 `templates/` 下。
30+
1. 初次开发前,运行 `just copy`,这会生成 `*.cls` 等并更新到 `templates/` 下。
3131
2. 编辑模板。
3232
3. 测试,确保你的改动能够正确编译;并且不会影响到其他效果。
3333

34-
### 修改 `bithesis.dtx` 文件
34+
### 修改 `bithesis*.dtx` 文件
3535

36-
1. 编辑 `bithesis.dtx`
37-
2. 运行 `make copy`,这会生成新的 `*.cls` 并更新到 `templates/` 下。
38-
3. 更新文档(`bithesis-doc.tex` 以及 `bithesis.dtx` 中的注释),然后运行 `make doc` 编译出手册`bithesis.pdf`
36+
1. 编辑 `src/bithesis*.dtx`
37+
2. 运行 `just copy`,这会生成新的 `*.cls` 并更新到 `templates/` 下。
38+
3. 更新文档(`src/bithesis-doc.tex` 以及 `src/bithesis*.dtx` 中的注释),然后运行 `just doc` 编译出手册`src/bithesis.pdf`
3939
4. 测试,确保你的改动不会影响到其他功能。
4040

4141
> [!TIP]
4242
>
43-
> 如果要添加新命令,可以先在 `templates/` 中具体实现,再拷贝到 `bithesis.dtx`
43+
> 如果要添加新命令,可以先在 `templates/` 中具体实现,再拷贝到 `bithesis*.dtx`
4444
4545
> [!NOTE]
46-
>
46+
>
4747
> 文档有两部分。
4848
>
4949
> - `bithesis-doc.tex`面向最终使用者,对应手册`bithesis.pdf`大部分内容。
50-
> - `bithesis.dtx`中的注释面向开发者。
50+
> - `bithesis*.dtx`中的注释面向开发者。
5151
>
5252
> <details>
5353
> <summary>注释中为何有 LaTeX 代码?</summary>
5454
>
55-
> `bithesis.dtx`最顶层的注释包含 LaTeX 代码,可输出为手册结尾「实现细节」一节;不过默认不输出,一般也无需单独检查输出结果。
55+
> `bithesis*.dtx`最顶层的注释包含 LaTeX 代码,可输出为手册结尾「实现细节」一节;不过默认不输出,一般也无需单独检查输出结果。
5656
>
57-
> 如需输出,请如下编辑`bithesis.dtx``\jobname`的值是`bithesis``\filename`的值是`bithesis.dtx`),然后照常编译手册。
57+
> 如需输出,请如下编辑`src/bithesis.dtx``\jobname`的值是`bithesis``\filename`的值是`bithesis.dtx`),然后照常编译手册。
5858
>
5959
> ```diff
6060
> \begin{document}
6161
> - \DocInput{\jobname-doc.tex}
62-
> + \DocInput{\jobname-doc.tex,\filename}
62+
> + \DocInput{\jobname-doc.tex,\filename,bithesis-thesis.dtx,bithesis-thesis-exports.dtx,bithesis-report.dtx,bithesis-beamer.dtx,bithesis-doc-style.dtx,bithesis-finale.dtx}
6363
> ```
6464
>
6565
> 相关功能的文档位于 [DocStrip](https://texdoc.org/serve/docstrip/0) 和 [l3doc](https://texdoc.org/serve/l3doc/0)。
@@ -93,11 +93,33 @@
9393
- 关于模板,[fduthesis 项目代码](https://github.com/stone-zeng/fduthesis)有很多最佳实践,可以参考。
9494
- 样式部分则应参考[研究生院](https://grd.bit.edu.cn/xwgz/xwgz2/wjxz_xwgz/)和教务部的相关文件和通知。
9595
96-
## Makefile 的进一步介绍
96+
## justfile 的进一步介绍
97+
98+
运行`just --list`可查看所有命令。
99+
100+
```shell
101+
$ just --list
102+
Available recipes:
103+
list # List available recipes
104+
105+
106+
[build]
107+
copy # Copy necessary files to templates/*/ and relevant directories
108+
doc # Build bithesis.pdf
109+
110+
111+
[dev]
112+
regression-test *ARGS # Run regression tests (run with `--help` for help)
113+
114+
115+
[release]
116+
pkg # Build bithesis.zip for submission to CTAN (mainly for CI)
117+
118+
```
97119
98120
### Windows
99121

100-
Makefile 主要针对 Linux 和 macOS 开发者;Windows 开发者要确保至少有:
122+
justfile 主要针对 Linux 和 macOS 开发者;Windows 开发者要确保至少有:
101123

102124
- GNU make——可按 [ScoopInstaller/Main: `make.json`](https://github.com/ScoopInstaller/Main/blob/master/bucket/make.json) 中的 `url` 下载。
103125
- GNU coreutils——可使用内置了 coreutils 的 Git Bash 或 Cygwin,或者[安装 uutils-coreutils](https://uutils.github.io/coreutils/docs/installation.html#windows)
@@ -106,20 +128,17 @@ Makefile 主要针对 Linux 和 macOS 开发者;Windows 开发者要确保至
106128

107129
### 辅助命令
108130

109-
我们常常需要实时预览代码编译的效果,而 LaTeX 本身没有提供实时编译的功能,导致我们要来回运行 `make copy`、`latexmk`。
110-
111-
为此 Makefile 提供了一些辅助命令,以 `dev-`开头,可以帮助你自动化以上流程。
131+
我们常常需要实时预览代码编译的效果,而 LaTeX 本身没有提供实时编译的功能,导致我们要来回运行 `just copy``latexmk`
112132

113-
或者你可以使用类似 `rg --files | entr make copy` 以及 `rg --files | entr latexmk` 来达到
114-
「代码修改后立即重新编译」的效果。
133+
其实可以使用类似 `rg --files | entr just copy` 以及 `rg --files | entr latexmk` 来达到「代码修改后立即重新编译」的效果。
115134

116135
(这些命令未必适用于 Windows,可能要手动用 [watchexec](https://watchexec.github.io/) 等替代。)
117136

118137
### 单元测试和回归测试
119138

120-
运行 `make test` 将对所有的模板进行编译测试(同样被用于 GitHub Actions)。
139+
运行 `just test` 将对所有的模板进行编译测试(同样被用于 GitHub Actions)。
121140

122-
运行 `make regression-test` 进行回归测试,该命令将比较目前已发布的最新版本和本地版本生成的 PDF 的差异。更多使用方式见 `make regression-test args='--help'`。
141+
运行 `just regression-test` 进行回归测试,该命令将比较目前已发布的最新版本和本地版本生成的 PDF 的差异。更多使用方式见 `just regression-test --help`
123142

124143
使用前请确保已经安装下面这些依赖。
125144

@@ -129,22 +148,8 @@ Makefile 主要针对 Linux 和 macOS 开发者;Windows 开发者要确保至
129148

130149
### 打包
131150

132-
- `make overleaf version=X.X.X` 可以生成上传 overleaf 所需要的 zip 文件。
133-
- `make pkg` 可以生成上传 CTAN 所需要的 zip 文件。若已有手册而不想重新编译,可 `make pkg-only`。(同样被用于 GitHub Actions)
134-
- `make grad version=X.X.X` 可以生成用作研究生院官网附件的 zip 文件。
135-
136-
### 上传 Overleaf 与更新
137-
138-
> [!NOTE]
139-
> Overleaf 链接已利用 [`overleaf.com/docs` API](https://www.overleaf.com/devs) 自动指向最新发布版,不再需要手动更新。
140-
141-
首先运行 `make overleaf` 打包文件。
142-
143-
1. 打开 Overleaf,点击左上角 `New Projects > Upload Projects` ,然后上传 zip 文件。
144-
2. 点击 `Menu > Compiler` 选择 `XeLaTeX`,然后重新编译。
145-
3. 修改项目名称,以便于区分。(我一般加上 `BIThesis-`)
146-
4. 点击 `Share > Turn on link sharing`,复制 read 权限的链接。
147-
5. 在 [`BIThesis-wiki` 项目的 `wiki/guide/preface.md`](https://github.com/BITNP/BIThesis-wiki/blob/main/wiki/guide/preface.md) 中,更新链接。
151+
- `just pkg` 可以生成上传 CTAN 所需要的 zip 文件。若已有手册而不想重新编译,可 `just pkg-only`。(同样被用于 GitHub Actions)
152+
- `just grad X.X.X` 可以生成用作研究生院官网附件的 zip 文件。
148153

149154
## Release 工作流
150155

@@ -155,3 +160,5 @@ Makefile 主要针对 Linux 和 macOS 开发者;Windows 开发者要确保至
155160
![Release Workflow](./assets/release_workflow.png)
156161

157162
上周展示了完整工作流,其中大部分已自动化,只需要手动触发。
163+
164+
- Overleaf 链接已利用 [`overleaf.com/docs` API](https://www.overleaf.com/devs) 自动指向最新发布版,不再需要手动更新。

0 commit comments

Comments
 (0)