Skip to content

Commit 8b59c63

Browse files
Merge pull request #14 from kazuyanagimoto/brand
Support brand.yml
2 parents 6907a38 + b4e8751 commit 8b59c63

9 files changed

Lines changed: 240 additions & 199 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ _site/
55
/.quarto/
66
.Rproj.user
77
.Renviron
8-
.DS_Store
8+
.DS_Store
9+
air.toml

README.md

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
# Quarto-awesomecv-typst Format
3+
# quarto-awesomecv-typst Format
44

55
A Quarto + Typst implementation of Byungjin Park’s
66
[Awesome-CV](https://github.com/posquit0/Awesome-CV). The Typst
@@ -54,22 +54,27 @@ author:
5454

5555
### Fonts & Color
5656

57-
You can set fonts and the accent color in YAML.
57+
You can set fonts and the accent color by
58+
[\_brand.yml](https://quarto.org/docs/authoring/brand.html) notation in
59+
YAML.
5860

5961
``` yaml
60-
style:
61-
color-accent: "516db0"
62-
color-link: "202b47"
63-
font-header: "Roboto"
64-
font-text: "Source Sans Pro"
65-
format:
66-
awesomecv-typst:
67-
font-paths: ["PATH_TO_FONT"]
62+
brand:
63+
typography:
64+
fonts:
65+
- family: Roboto
66+
source: google
67+
- family: Source Sans 3
68+
source: google
69+
base: Source Sans 3
70+
color:
71+
primary: "#516db0"
72+
link: "#202b47"
73+
defaults:
74+
awesomecv-typst:
75+
font-header: Roboto
6876
```
6977

70-
By default, it uses the system fonts, but you can specify the font paths
71-
in the `font-paths` field (e.g., GitHub Actions usage.)
72-
7378
### Profile Photo
7479

7580
You can set a profile photo in YAML. If you set it, the header will be
@@ -113,10 +118,10 @@ Please refer to the package
113118
library(typstcv)
114119
115120
educ <- data.frame(
116-
title = c("Ph.D. in Physics", "Master of Science"),
117-
location = c("Zürich, Switzerland", "Zürich, Switzerland"),
118-
date = c("1905", "1896 - 1900"),
119-
description = c("University of Zürich", "ETH")
121+
title = c("Ph.D. in Physics", "Master of Science"),
122+
location = c("Zürich, Switzerland", "Zürich, Switzerland"),
123+
date = c("1905", "1896 - 1900"),
124+
description = c("University of Zürich", "ETH")
120125
)
121126
122127
resume_entry(educ)
@@ -129,12 +134,12 @@ resume_entry(educ)
129134

130135
``` r
131136
award <- data.frame(
132-
title = c("Nobel Prize in Physics"),
133-
location = c("Stockholm, Sweden"),
134-
date = c("1921"),
135-
description = c("For his services to"),
136-
detail1 = c("Theoretical Physics"),
137-
detail2 = c("Discovery of the law of the photoelectric effect")
137+
title = c("Nobel Prize in Physics"),
138+
location = c("Stockholm, Sweden"),
139+
date = c("1921"),
140+
description = c("For his services to"),
141+
detail1 = c("Theoretical Physics"),
142+
detail2 = c("Discovery of the law of the photoelectric effect")
138143
)
139144
140145
resume_entry(award, details = c("detail1", "detail2"))
@@ -150,24 +155,24 @@ resume_entry(award, details = c("detail1", "detail2"))
150155

151156
``` r
152157
work <- data.frame(
153-
title = c("Technical Assistant", "Junior Professor", "Associate Professor"),
154-
location = c(
155-
"Bern, Switzerland",
156-
"Bern, Switzerland",
157-
"Zürich, Switzerland"
158-
),
159-
start = as.Date(c("1902-01-01", "1908-01-01", "1909-01-01")),
160-
end = as.Date(c("1908-01-01", "1909-01-01", "1911-01-01")),
161-
description = c(
162-
"Federal Patent Office",
163-
"University of Bern",
164-
"University of Zürich"
165-
)
158+
title = c("Technical Assistant", "Junior Professor", "Associate Professor"),
159+
location = c(
160+
"Bern, Switzerland",
161+
"Bern, Switzerland",
162+
"Zürich, Switzerland"
163+
),
164+
start = as.Date(c("1902-01-01", "1908-01-01", "1909-01-01")),
165+
end = as.Date(c("1908-01-01", "1909-01-01", "1911-01-01")),
166+
description = c(
167+
"Federal Patent Office",
168+
"University of Bern",
169+
"University of Zürich"
170+
)
166171
)
167172
168173
work |>
169-
format_date(end = "end", date_format = "%Y", sort_by = "start") |>
170-
resume_entry()
174+
format_date(end = "end", date_format = "%Y", sort_by = "start") |>
175+
resume_entry()
171176
```
172177

173178
```{=typst}

README.qmd

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
format: gfm
33
---
44

5-
# Quarto-awesomecv-typst Format
5+
# quarto-awesomecv-typst Format
66

77
A Quarto + Typst implementation of Byungjin Park’s [Awesome-CV](https://github.com/posquit0/Awesome-CV).
88
The Typst implementation part is inspired by Paul Tsouchlos’s [modern-cv](https://typst.app/universe/package/modern-cv/)
99

1010
```{r}
1111
#| include: false
1212
system2(
13-
"pdftocairo",
14-
args = c("-png", "_site/template.pdf", "assets/img/template")
13+
"pdftocairo",
14+
args = c("-png", "_site/template.pdf", "assets/img/template")
1515
)
1616
system2(
17-
"magick",
18-
args = c(
19-
"assets/img/template-1.png",
20-
"-crop",
21-
"2000x600+0+0",
22-
"assets/img/thumbnail.png"
23-
)
17+
"magick",
18+
args = c(
19+
"assets/img/template-1.png",
20+
"-crop",
21+
"2000x600+0+0",
22+
"assets/img/thumbnail.png"
23+
)
2424
)
2525
unlink("assets/img/template-1.png")
2626
```
@@ -68,21 +68,25 @@ via [duskmoon314/typst-fontawesome](https://github.com/duskmoon314/typst-fontawe
6868

6969
### Fonts & Color
7070

71-
You can set fonts and the accent color in YAML.
71+
You can set fonts and the accent color by [_brand.yml](https://quarto.org/docs/authoring/brand.html) notation in YAML.
7272

7373
```yaml
74-
style:
75-
color-accent: "516db0"
76-
color-link: "202b47"
77-
font-header: "Roboto"
78-
font-text: "Source Sans Pro"
79-
format:
80-
awesomecv-typst:
81-
font-paths: ["PATH_TO_FONT"]
74+
brand:
75+
typography:
76+
fonts:
77+
- family: Roboto
78+
source: google
79+
- family: Source Sans 3
80+
source: google
81+
base: Source Sans 3
82+
color:
83+
primary: "#516db0"
84+
link: "#202b47"
85+
defaults:
86+
awesomecv-typst:
87+
font-header: Roboto
8288
```
8389

84-
By default, it uses the system fonts, but you can specify the font paths in the `font-paths` field (e.g., GitHub Actions usage.)
85-
8690
### Profile Photo
8791

8892
You can set a profile photo in YAML.
@@ -124,46 +128,46 @@ Please refer to the package [documentation](http://kazuyanagimoto.com/typstcv/)
124128
library(typstcv)
125129
126130
educ <- data.frame(
127-
title = c("Ph.D. in Physics", "Master of Science"),
128-
location = c("Zürich, Switzerland", "Zürich, Switzerland"),
129-
date = c("1905", "1896 - 1900"),
130-
description = c("University of Zürich", "ETH")
131+
title = c("Ph.D. in Physics", "Master of Science"),
132+
location = c("Zürich, Switzerland", "Zürich, Switzerland"),
133+
date = c("1905", "1896 - 1900"),
134+
description = c("University of Zürich", "ETH")
131135
)
132136
133137
resume_entry(educ)
134138
```
135139

136140
```{r}
137141
award <- data.frame(
138-
title = c("Nobel Prize in Physics"),
139-
location = c("Stockholm, Sweden"),
140-
date = c("1921"),
141-
description = c("For his services to"),
142-
detail1 = c("Theoretical Physics"),
143-
detail2 = c("Discovery of the law of the photoelectric effect")
142+
title = c("Nobel Prize in Physics"),
143+
location = c("Stockholm, Sweden"),
144+
date = c("1921"),
145+
description = c("For his services to"),
146+
detail1 = c("Theoretical Physics"),
147+
detail2 = c("Discovery of the law of the photoelectric effect")
144148
)
145149
146150
resume_entry(award, details = c("detail1", "detail2"))
147151
```
148152

149153
```{r}
150154
work <- data.frame(
151-
title = c("Technical Assistant", "Junior Professor", "Associate Professor"),
152-
location = c(
153-
"Bern, Switzerland",
154-
"Bern, Switzerland",
155-
"Zürich, Switzerland"
156-
),
157-
start = as.Date(c("1902-01-01", "1908-01-01", "1909-01-01")),
158-
end = as.Date(c("1908-01-01", "1909-01-01", "1911-01-01")),
159-
description = c(
160-
"Federal Patent Office",
161-
"University of Bern",
162-
"University of Zürich"
163-
)
155+
title = c("Technical Assistant", "Junior Professor", "Associate Professor"),
156+
location = c(
157+
"Bern, Switzerland",
158+
"Bern, Switzerland",
159+
"Zürich, Switzerland"
160+
),
161+
start = as.Date(c("1902-01-01", "1908-01-01", "1909-01-01")),
162+
end = as.Date(c("1908-01-01", "1909-01-01", "1911-01-01")),
163+
description = c(
164+
"Federal Patent Office",
165+
"University of Bern",
166+
"University of Zürich"
167+
)
164168
)
165169
166170
work |>
167-
format_date(end = "end", date_format = "%Y", sort_by = "start") |>
168-
resume_entry()
171+
format_date(end = "end", date_format = "%Y", sort_by = "start") |>
172+
resume_entry()
169173
```

_extensions/awesomecv/_extension.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
title: Quarto-awesomecv-typst
1+
title: quarto-awesomecv-typst
22
author: Kazuharu Yanagimoto
3-
version: 0.2.0
4-
quarto-required: ">=1.7.32"
3+
version: 0.3.0
4+
quarto-required: ">=1.7.33"
55
contributes:
66
formats:
77
typst:

_extensions/awesomecv/typst-show.typ

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
// Typst custom formats typically consist of a 'typst-template.typ' (which is
2-
// the source code for a typst template) and a 'typst-show.typ' which calls the
3-
// template's function (forwarding Pandoc metadata values as required)
4-
//
5-
// This is an example 'typst-show.typ' file (based on the default template
6-
// that ships with Quarto). It calls the typst function named 'article' which
7-
// is defined in the 'typst-template.typ' file.
8-
//
9-
// If you are creating or packaging a custom typst template you will likely
10-
// want to replace this file and 'typst-template.typ' entirely. You can find
11-
// documentation on creating typst templates here and some examples here:
12-
// - https://typst.app/docs/tutorial/making-a-template/
13-
// - https://github.com/typst/templates
14-
151
#show: resume.with(
162
$if(title)$
173
title: [$title$],
@@ -35,4 +21,24 @@ $endif$
3521
$if(profile-photo)$
3622
profile-photo: unescape_text("$profile-photo$"),
3723
$endif$
24+
$if(style.font-header)$
25+
font-header: ("$style.font-header$",),
26+
$elseif(brand.defaults.awesomecv-typst.font-header)$
27+
font-header: ("$brand.defaults.awesomecv-typst.font-header$", ),
28+
$endif$
29+
$if(style.font-text)$
30+
font-text: ("$style.font-text$",),
31+
$elseif(brand.typography.base.family)$
32+
font-text: $brand.typography.base.family$,
33+
$endif$
34+
$if(style.color-accent)$
35+
color-accent: rgb("$style.color-accent$"),
36+
$elseif(brand.color.primary)$
37+
color-accent: brand-color.primary,
38+
$endif$
39+
$if(style.color-link)$
40+
color-link: rgb("$style.color-link$"),
41+
$elseif(brand.color.link)$
42+
color-link: brand-color.link,
43+
$endif$
3844
)

0 commit comments

Comments
 (0)