-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib.typ
136 lines (134 loc) · 3.45 KB
/
lib.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#import "layout/document.typ": doc
#import "fonts/fonts.typ": font-size, font-family
#import "pages/bachelor-cover.typ": bachelor-cover
#import "pages/bachelor-declare.typ": bachelor-declare
#import "pages/bachelor-abstract.typ": bachelor-abstract
#import "pages/toc-page.typ": toc
#import "layout/mainmatter.typ": mainmatter
#import "pages/reference.typ": nenu-bibliography
#import "pages/ackonwledge.typ": acknowledgement
#import "@preview/anti-matter:0.1.1": fence
#import "@preview/kouhu:0.1.0": kouhu
#import "@preview/codly:1.1.1": *
#import "@preview/codly-languages:0.1.1": *
#let thesis(
// TODO 新增 "master" 和 "phd" 类型
thesis-type: "bachelor",
// TODO 新增学位类型的选项(只在硕士和博士学位生效)
degree: "academic",
// TODO 双面模式,在封面与封底插入空白页
two-side: false,
// 参考文献函数
bibliography: none,
// 字体
fonts: (:),
// 额外信息
info: (:),
// 关键词
keywords-cn: (),
keywords-en: (),
) = {
fonts = font-family + fonts
info = (
(
title: "毕业论文中文题目",
title-en: "毕业论文英文题目",
student-id: "123456",
author: "张三",
department: "信息科学与技术学院",
major: "计算机科学与技术",
supervisor: "李四",
submit-date: datetime.today(),
) + info
)
(
thesis-type: thesis-type,
degree: degree,
two-side: two-side,
fonts: fonts,
info: info,
//TODO 分发更多函数
doc: (..args) => {
doc(
..args,
info: info + args.named().at("info", default: (:)),
thesis-type: thesis-type,
)
},
mainmatter: (..args) => {
mainmatter(..args)
},
fence: (..args) => {
fence(..args)
},
cover: (..args) => {
if thesis-type == "bachelor" {
bachelor-cover(
two-side: two-side,
fonts: fonts + args.named().at("fonts", default: (:)),
info: info + args.named().at("info", default: (:)),
..args,
)
} else {
panic("Not Implemented Yet!")
}
},
declare: (..args) => {
if thesis-type == "bachelor" {
bachelor-declare(
two-side: two-side,
fonts: fonts + args.named().at("fonts", default: (:)),
..args,
)
counter(page).update(0)
} else {
panic("Not Implemented Yet!")
}
},
abstract-cn: (..args) => {
if thesis-type == "bachelor" {
bachelor-abstract(
two-side: two-side,
fonts: fonts + args.named().at("fonts", default: (:)),
display-lang: "cn",
keywords: keywords-cn,
..args,
)
} else {
panic("Not Implemented Yet!")
}
},
abstract-en: (..args) => {
if thesis-type == "bachelor" {
bachelor-abstract(
two-side: two-side,
fonts: fonts + args.named().at("fonts", default: (:)),
display-lang: "en",
keywords: keywords-en,
..args,
)
} else {
panic("Not Implemented Yet!")
}
},
toc: (..args) => {
toc(
two-side: two-side,
fonts: fonts + args.named().at("fonts", default: (:)),
..args,
)
},
nenu-bibliography: (..args) => {
nenu-bibliography(
bibliography: bibliography,
..args,
)
},
acknowledgement: (..args) => {
acknowledgement(
two-side: two-side,
..args,
)
},
)
}