Skip to content

Commit

Permalink
Fix #15
Browse files Browse the repository at this point in the history
  • Loading branch information
tingerrr committed Aug 26, 2024
1 parent baa8a1e commit 3096542
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
## Changed

## Fixed
- Passing `grid` sub-elements to `subpar.grid` now correctly passses them though
to `grid`

---

Expand Down
17 changes: 16 additions & 1 deletion src/lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,22 @@
show-sub-caption: show-sub-caption,

_grid(
.._util.stitch-pairs(figures).map(((f, l)) => [#f#l]),
.._util.stitch-pairs(figures).map(((f, l)) => if type(f) == content and f.func() == _grid.cell {
assert.eq(
l, none,
message: "When using `grid.cell` in `subpar.grid`, place labels inside the cell itself",
)
f
} else if type(f) == content and f.func() in (
_grid.hline,
_grid.vline,
_grid.header,
_grid.footer,
) {
f
} else {
[#f#l]
}),
..grid-args,
),
)
Expand Down
Binary file added test/grid-cell/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.
16 changes: 16 additions & 0 deletions test/grid-cell/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Synopsis:
// - passing a grid sub element works as expected

#import "/test/util.typ": *
#import "/src/lib.typ" as subpar

#subpar.grid(
grid.cell([#figure(fake-image, caption: [Inner Caption]) <1a>], colspan: 2),
figure(fake-image, caption: [Inner Caption]), <1b>,
grid.vline(),
figure(fake-image, caption: [Inner Caption]), <1c>,
grid.hline(),
columns: (1fr, 1fr),
caption: [Super],
label: <1>,
)

0 comments on commit 3096542

Please sign in to comment.