Skip to content

Commit 9ce897c

Browse files
committed
Fix error with typst 0.8.0
1 parent 647d003 commit 9ce897c

File tree

10 files changed

+35
-9
lines changed

10 files changed

+35
-9
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: yusancky/setup-typst@v2
2222
id: setup-typst
2323
with:
24-
version: 'v0.7.0'
24+
version: 'v0.8.0'
2525
- run: |
2626
just build
2727
- name: Create Release

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
- uses: yusancky/setup-typst@v2
1818
id: setup-typst
1919
with:
20-
version: 'v0.7.0'
20+
version: 'v0.8.0'
2121
- run: |
2222
just test

.github/workflows/update-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: yusancky/setup-typst@v2
1919
id: setup-typst
2020
with:
21-
version: 'v0.7.0'
21+
version: 'v0.8.0'
2222
- run: |
2323
typst fonts
2424
- run: |

my-index.typ

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,51 @@ figure(
1010
)))
1111

1212
#let make-index-int(title: none, main_color_state:none) = {
13+
14+
let content-text(content) = {
15+
let ct = ""
16+
if content.has("text") {
17+
ct = content.text
18+
}
19+
else {
20+
for cc in content.children {
21+
if cc.has("text") {
22+
ct += cc.text
23+
}
24+
}
25+
}
26+
return ct
27+
}
28+
1329
pagebreak(to: "odd")
1430
set par(first-line-indent: 0em)
1531
locate(loc => {
1632
let mainColor = main_color_state.at(loc)
17-
let elements = query(selector(figure.where(kind: index_string)).before(loc), loc)
33+
let elements = query(selector(figure.where(kind: index_string)).before(loc), loc)
1834
let words = (:)
1935
for el in elements {
2036
let ct = ""
21-
ct = el.caption.text
37+
if el.caption.has("body"){
38+
ct = content-text(el.caption.body)
39+
}
40+
else{
41+
ct = content-text(el.caption)
42+
}
43+
44+
// Have we already know that entry text? If not,
45+
// add it to our list of entry words
2246
if words.keys().contains(ct) != true {
2347
words.insert(ct, ())
2448
}
49+
50+
// Add the new page entry to the list.
2551
let ent = (class: el.body.text, page: el.location().page())
2652
if not words.at(ct).contains(ent){
2753
words.at(ct).push(ent)
2854
}
2955
}
3056

57+
3158
let sortedkeys = words.keys().sorted()
3259

3360
let register = ""
@@ -50,8 +77,7 @@ figure(
5077
#if(sk.contains("!")){
5178
h(2em)
5279
sk.slice(sk.position("!")+1)
53-
}
54-
else{
80+
}else{
5581
sk
5682
}
5783
#box(width: 1fr, repeat(text(weight: "regular")[. #h(4pt)]))

tests/long-part-title/test.typ

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
listOfFigureTitle: "List of Figures",
1919
listOfTableTitle: "List of Tables",
2020
supplementChapter: "Chapter",
21+
part_style: 0,
2122
copyright: [
2223
Copyright © 2023 Flavio Barisi
2324

tests/sample-book/ref19.png

105 Bytes
Loading

tests/sample-book/ref21.png

-79 Bytes
Loading

tests/sample-book/ref22.png

305 Bytes
Loading

tests/sample-book/ref23.png

219 Bytes
Loading

typst-orange.typ

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
#place(block(width:100%, height:100%, outset: (x: 3cm, bottom: 2.5cm, top: 3cm), fill: mainColor.lighten(70%)))
7676
#place(top+right, text(fill: black, size: largeText, weight: "bold", box(width: 60%, part_state.display())))
7777
#place(top+left, text(fill: mainColor, size: hugeText, weight: "bold", part_counter.display("I")))
78-
]
79-
else if part_style == 1 [
78+
] else if part_style == 1 [
8079
#set par(justify: false)
8180
#place(block(width:100%, height:100%, outset: (x: 3cm, bottom: 2.5cm, top: 3cm), fill: mainColor.lighten(70%)))
8281
#place(top+left)[

0 commit comments

Comments
 (0)