Skip to content

Commit

Permalink
refactor: removed width measurement for code blocks
Browse files Browse the repository at this point in the history
refactor: removed width measurement for code blocks

# Conflicts:
#	tests/colors/ref/1.png
#	tests/colors/ref/2.png
#	tests/colors/ref/3.png
#	tests/colors/ref/4.png
  • Loading branch information
TimeTravelPenguin committed Jan 5, 2025
1 parent db33533 commit 34b8656
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 28 deletions.
Binary file added src/styling/code.pdf
Binary file not shown.
6 changes: 0 additions & 6 deletions src/styling/code.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
outset: 3pt,
radius: 3pt,
breakable: false,
width: it => measure(it).width + 2cm,
)

#let default-code-box-config = (
Expand Down Expand Up @@ -45,11 +44,6 @@
#show raw.where(block: true): it => (
context [
#let config = default-code-block-config + (fill: palette.colors.crust.rgb) + block-config

#if type(config.at("width")) == function {
config.insert("width", (config.at("width"))(it))
}

#block(..config, it)
]
)
Expand Down
Binary file modified tests/background/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 23 additions & 21 deletions tests/background/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,33 @@
}
}

#for p in perms [
#pagebreak(weak: true)
#show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
#for p in perms {
show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
pagebreak(weak: true)

= #get-flavor(p.flavor).name
- Code block: #p.code-block
- Code syntax: #p.syntax
[
= #get-flavor(p.flavor).name
- Code block: #p.code-block
- Code syntax: #p.syntax

```typ
#import "/src/lib.typ": catppuccin, flavors, get-flavor
```typ
#import "/src/lib.typ": catppuccin, flavors, get-flavor
#let perms = ()
#for flavor in flavors.values() {
for code-block in (true, false) {
for syntax in (true, false) {
perms.push((flavor: flavor, code-block: code-block, syntax: syntax))
#let perms = ()
#for flavor in flavors.values() {
for code-block in (true, false) {
for syntax in (true, false) {
perms.push((flavor: flavor, code-block: code-block, syntax: syntax))
}
}
}
}
#for p in perms [
#show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
= #get-flavor(p.flavor).name
== Code block: #p.code-block
== Code syntax: #p.syntax
#for p in perms [
#show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
= #get-flavor(p.flavor).name
== Code block: #p.code-block
== Code syntax: #p.syntax
]
```
]
```
]
}
Binary file modified tests/colors/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/colors/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
grid(
columns: 4,
column-gutter: 1cm,
row-gutter: 1em,
row-gutter: 3.5mm,
..swatches,
)
}
Expand Down

0 comments on commit 34b8656

Please sign in to comment.