Skip to content

Commit 72c07da

Browse files
committed
bring various settings up-to-date with the template, especially with tytanic and tidy 0.4
1 parent aa8912a commit 72c07da

30 files changed

+10019
-230
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ jobs:
1010
strategy:
1111
matrix:
1212
# add any other Typst versions that your package should support
13-
typst-version: ["0.11", "0.12"]
13+
typst-version:
14+
- typst: 0.12
15+
tytanic: 0.1
1416
# the docs don't need to build with all versions supported by the package;
1517
# the latest one is enough
1618
include:
17-
- typst-version: "0.12"
19+
- typst-version: {typst: 0.12, tytanic: 0.1}
1820
doc: 1
1921
runs-on: ubuntu-latest
2022
steps:
@@ -24,43 +26,37 @@ jobs:
2426
- name: Probe runner package cache
2527
uses: awalsh128/cache-apt-pkgs-action@v1
2628
with:
27-
packages: imagemagick cargo
29+
packages: cargo
2830
version: 1.0
2931

30-
- name: Install oxipng from crates.io
31-
uses: baptiste0928/cargo-install@v3
32-
with:
33-
crate: oxipng
34-
3532
- name: Install just from crates.io
3633
uses: baptiste0928/cargo-install@v3
3734
with:
3835
crate: just
3936

40-
- name: Install typst-test from github
37+
- name: Install tytanic from crates.io
4138
uses: baptiste0928/cargo-install@v3
4239
with:
43-
crate: typst-test
44-
git: https://github.com/tingerrr/typst-test.git
45-
tag: ci-semi-stable
40+
crate: tytanic
41+
version: ${{ matrix.typst-version.tytanic }}
4642

4743
- name: Setup typst
4844
id: setup-typst
4945
uses: typst-community/setup-typst@v3
5046
with:
51-
typst-version: ${{ matrix.typst-version }}
47+
typst-version: ${{ matrix.typst-version.typst }}
5248

5349
- name: Install package locally
5450
run: just install-preview
5551

5652
- name: Run test suite
5753
run: just test
5854

59-
- name: Archive diffs
55+
- name: Archive test results
6056
uses: actions/upload-artifact@v4
6157
if: always()
6258
with:
63-
name: typst-${{ steps.setup-typst.outputs.typst-version }}-diffs
59+
name: typst-${{ steps.setup-typst.outputs.typst-version }}-test-results
6460
path: |
6561
tests/**/diff/*.png
6662
tests/**/out/*.png

CHANGELOG.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
1-
# [unreleased](https://github.com/SillyFreak/typst-scrutinize/releases/tag/)
2-
## Added
1+
# Changelog
32

4-
## Removed
3+
All notable changes to this project will be documented in this file.
54

6-
## Changed
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## Migration Guide from v0.1.X
8+
## [Unreleased]
99

10-
---
10+
<details>
11+
<summary>Migration guide from v0.1.x</summary>
12+
13+
<!-- Write migration guide here -->
14+
15+
</details>
16+
17+
### Added
18+
19+
### Changed
20+
21+
### Deprecated
22+
23+
### Removed
24+
25+
### Fixed
26+
27+
### Security
28+
29+
## [0.3.0] - 2024-10-12
1130

12-
# [v0.3.0](https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.3.0)
1331
Scrutinize 0.3.0 is a major breaking release and adds compatiblitity checks for Typst 0.12 compatibility (this version was released when 0.12.0-rc1 was available).
1432

15-
## Added
33+
### Added
1634
- the README now contains images of an example exam
1735
- the task kinds `free-form.lines()`, `free-form.grid()` and `gap.gap()` were added
1836
- `free-form` and `gap` tasks have additional configuration options:
1937
- `stretch` resizes the response space relative to the size of the sample solution
2038
- `placeholder` adds content to show in the answer space in the unsolved exam. This is useful for tasks where something existing needs to be completed.
2139
- tasks can now be fetched in a "scope" of the document, allowing e.g. multiple independent exams
2240

23-
## Changed
41+
### Changed
2442
- the module stucture was changed
2543
- the `question` module was renamed to `task` to be shorter and more general
2644
- `questions` was renamed to `task-kinds` to match, and to be more descriptive
@@ -29,18 +47,22 @@ Scrutinize 0.3.0 is a major breaking release and adds compatiblitity checks for
2947
- the `q()` function (now `t()`) does not wrap a whole task but instead attaches to the preceding heading
3048
- tasks can now have subtasks, by using nested headings
3149

32-
---
50+
## [0.2.0] - 2024-03-16
3351

34-
# [v0.2.0](https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.2.0)
3552
Scrutinize 0.2.0 updates it to Typst 0.11.0, using context to simplify the API and --input to more easily specify if a sample solution is to be generated. Some documentation and metadata errors in the 0.1.0 submission were also corrected.
3653

37-
## Added
54+
### Added
3855
- specify solution state via `--input solution=true`
3956

40-
## Changed
57+
### Changed
4158
- functions that formerly took callback parameters to give access to state now depend on context being provided and simply return a value
4259

43-
---
60+
## [0.1.0] - 2024-01-07
4461

45-
# [v0.1.0](https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.1.0)
4662
Initial Release
63+
64+
65+
[Unreleased]: https://github.com/SillyFreak/typst-scrutinize/compare/v0.3.0...HEAD
66+
[0.3.0]: https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.3.0
67+
[0.2.0]: https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.2.0
68+
[0.1.0]: https://github.com/SillyFreak/typst-scrutinize/releases/tag/v0.1.0

Justfile

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,28 @@ export TYPST_ROOT := root
44

55
[private]
66
default:
7-
@just --list --unsorted
7+
@just --list --unsorted
88

99
# generate manual
1010
doc:
11-
typst compile docs/manual.typ docs/manual.pdf
12-
for f in $(find gallery -maxdepth 1 -name '*.typ'); do \
13-
f="$(dirname "$f")/$(basename "$f" .typ)"; \
14-
typst compile "$f.typ"; \
15-
typst compile "$f.typ" "$f-solved.pdf" --input solution=true; \
16-
done
17-
18-
mkdir -p tmp
19-
typst compile --ppi 250 "gallery/example.typ" "tmp/example{n}.png"
20-
typst compile --ppi 250 "gallery/example.typ" "tmp/example-solved{n}.png" --input solution=true
21-
mv tmp/example1.png thumbnail.png
22-
mv tmp/example-solved1.png thumbnail-solved.png
23-
rm tmp/example*.png
24-
rmdir tmp
11+
typst compile docs/manual.typ docs/manual.pdf
12+
typst compile --pages 1 gallery/example.typ thumbnail-light.svg
13+
typst compile --pages 1 --input theme=dark gallery/example.typ thumbnail-dark.svg
14+
typst compile --pages 1 --input solution=true gallery/example.typ thumbnail-light-solved.svg
15+
typst compile --pages 1 --input solution=true --input theme=dark gallery/example.typ thumbnail-dark-solved.svg
16+
for f in $(find gallery -maxdepth 1 -name '*.typ'); do \
17+
f="$(dirname "$f")/$(basename "$f" .typ)"; \
18+
typst compile "$f.typ"; \
19+
typst compile "$f.typ" "$f-solved.pdf" --input solution=true; \
20+
done
2521

2622
# run test suite
2723
test *args:
28-
typst-test run {{ args }}
24+
tt run {{ args }}
2925

3026
# update test cases
3127
update *args:
32-
typst-test update {{ args }}
28+
tt update {{ args }}
3329

3430
# package the library into the specified destination folder
3531
package target:

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ See the [manual](docs/manual.pdf) for details.
1717
<table>
1818
<tr>
1919
<td>
20-
<a href="gallery/gk-ek-austria.typ">
21-
<img src="thumbnail.png">
20+
<a href="gallery/example.typ">
21+
<picture>
22+
<source media="(prefers-color-scheme: dark)" srcset="./thumbnail-dark.svg">
23+
<img src="./thumbnail-light.svg">
24+
</picture>
2225
</a>
2326
</td>
2427
<td>
25-
<a href="gallery/gk-ek-austria.typ">
26-
<img src="thumbnail-solved.png">
28+
<a href="gallery/example.typ">
29+
<picture>
30+
<source media="(prefers-color-scheme: dark)" srcset="./thumbnail-dark-solved.svg">
31+
<img src="./thumbnail-light-solved.svg">
32+
</picture>
2733
</a>
2834
</td>
2935
</tr>

docs/man-style.typ

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// adapted from https://github.com/Mc-Zen/tidy/blob/v0.3.0/src/styles/minimal.typ
22

3-
#import "@preview/tidy:0.3.0"
4-
#import tidy.utilities: *
5-
63
// ==== internal utilities
74

85
#let mono = text.with(font: "DejaVu Sans Mono", size: 0.85em, weight: 340)
@@ -55,15 +52,15 @@
5552
}
5653

5754
#let preview-block(no-codly: true, ..args) = {
58-
import "@preview/codly:1.0.0"
55+
import "template.typ": codly
5956

60-
show: if no-codly { codly.no-codly } else { it => it }
61-
block(
62-
stroke: 0.5pt + luma(200),
63-
radius: preview-radius,
64-
..args
65-
)
66-
}
57+
show: if no-codly { codly.no-codly } else { it => it }
58+
block(
59+
stroke: 0.5pt + luma(200),
60+
radius: preview-radius,
61+
..args
62+
)
63+
}
6764

6865
// ==== functions required from styles
6966

@@ -85,15 +82,17 @@
8582
grid(
8683
columns: (1fr,) * 3,
8784
column-gutter: 0.5em,
88-
..entries.chunks(calc.ceil(entries.len() / 3)).map(entries => {
89-
block(
90-
fill: gray.lighten(80%),
91-
width: 100%,
92-
inset: (y: 0.6em),
93-
radius: radius,
94-
list(..entries)
95-
)
96-
}),
85+
..if entries.len() != 0 {
86+
entries.chunks(calc.ceil(entries.len() / 3)).map(entries => {
87+
block(
88+
fill: gray.lighten(80%),
89+
width: 100%,
90+
inset: (y: 0.6em),
91+
radius: radius,
92+
list(..entries)
93+
)
94+
})
95+
},
9796
)
9897
}
9998

@@ -107,6 +106,9 @@
107106
#let show-function(
108107
fn, style-args,
109108
) = {
109+
import "template.typ": tidy
110+
import tidy.utilities: *
111+
110112
block(breakable: style-args.break-param-descriptions, {
111113
let parameter-list = (style-args.style.show-parameter-list)(fn, style-args)
112114
let lbl = if style-args.enable-cross-references {
@@ -187,6 +189,9 @@
187189
#let show-variable(
188190
var, style-args,
189191
) = {
192+
import "template.typ": tidy
193+
import tidy.utilities: *
194+
190195
signature-block(breakable: style-args.break-param-descriptions, {
191196
let var-signature = mono-fn(
192197
var.name,
@@ -208,7 +213,7 @@
208213
/// Takes given code and both shows it and previews the result of its evaluation.
209214
///
210215
/// The code is by default shown in the language mode `lang: typc` (typst code)
211-
/// if no language has been specified. Code in typst markup lanugage (`lang: typ`)
216+
/// if no language has been specified. Code in typst markup language (`lang: typ`)
212217
/// is automatically evaluated in markup mode.
213218
///
214219
/// - code (raw): Raw object holding the example code.

docs/manual.pdf

1.65 KB
Binary file not shown.

docs/manual.typ

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#import "template.typ" as template: *
22
#import "/src/lib.typ": grading, task, solution, task-kinds
33

4+
#import "@preview/crudo:0.1.1"
5+
46
#let package-meta = toml("/typst.toml").package
57
#let date = datetime(year: 2024, month: 10, day: 12)
68

docs/template.typ

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// adapted from https://github.com/Mc-Zen/tidy/blob/98612b847da41ffb0d1dc26fa250df5c17d50054/docs/template.typ
22
// licensed under the MIT license
33

4-
#import "@preview/tidy:0.3.0"
5-
#import "@preview/codly:1.0.0"
6-
#import "@preview/crudo:0.1.1"
4+
#import "@preview/tidy:0.4.1"
5+
#import "@preview/codly:1.2.0"
76

87
#import "man-style.typ"
98

@@ -92,6 +91,7 @@
9291
show: codly.codly-init
9392
show raw.where(block: true): set text(size: .9em)
9493
show raw.where(block: true): pad.with(x: 4%)
94+
codly.codly(fill: white)
9595

9696
body
9797
}
@@ -145,7 +145,7 @@
145145
block(align(right, text(raw(filename))), width: 100%, inset: 5pt)
146146
v(1pt, weak: true)
147147
move(dx: -1pt, line(length: 100% + 2pt, stroke: 1pt + rgb("#239DAE")))
148-
v(1pt, weak: true)
148+
v(1pt, weak: true)
149149
pad(x: -4.3%, code)
150150
}
151151
))
@@ -163,7 +163,7 @@
163163
inset: 20pt,
164164
)
165165
show: align.with(left)
166-
block(breakable: false, body)
166+
block(breakable: false, body)
167167
}
168168
)
169169
}

gallery/example-solved.pdf

304 Bytes
Binary file not shown.

gallery/example.pdf

782 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)