forked from nju-lug/modern-nju-thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juntong Chen <[email protected]>
- Loading branch information
Showing
13 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,24 @@ | |
* @project: modern-ecnu-thesis | ||
* @author: Juntong Chen ([email protected]) | ||
* @created: 2025-01-12 15:12:15 | ||
* @modified: 2025-01-12 15:54:13 | ||
* @modified: 2025-01-12 22:12:32 | ||
* | ||
* Copyright (c) 2025 Juntong Chen. All rights reserved. | ||
*/ | ||
|
||
// 截止 Typst 0.12.0 版本,CJK 字符的换行处理还不够完善,可能会插入不必要的空格。这里提供一个 workaround。 | ||
// 详见:https://github.com/typst/typst/issues/792#issuecomment-2310139085 | ||
#let fix-cjk-linebreak(body) = [ | ||
#let fix-cjk-linebreak(body, debug: false) = [ | ||
// 不去除章后的字符 | ||
#let cjk-char = "[\p{Han},。;:!?‘’“”()「」【】…—&&[^章节]]" | ||
// 没有使用 \s 来匹配空白字符的原因是为了保留全角空格。 | ||
#let cjk-re = regex("[ \\t\\n\\r]*(" + cjk-char + ")[ \\t\\n\\r]*") | ||
#let cjk-re = regex("(" + cjk-char + ")([ \\t\\r]+(" + cjk-char + ")+)+") | ||
#show cjk-re: it => { | ||
it.text.match(cjk-re).captures.at(0) | ||
if debug { | ||
highlight(fill: color.red, it.text) | ||
} else { | ||
it.text.replace(regex("[ \\t\\r]+"), "") | ||
} | ||
} | ||
#show: rest => { | ||
let ends-with-cjk = it => { | ||
|