Skip to content

Commit b19f1e1

Browse files
authored
Merge pull request #12817 from quarto-dev/bugfix/12815
lua,typst - do not crash if float.content is nil
2 parents 432c04f + dd4448f commit b19f1e1

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ All changes included in 1.8:
3333
- ([#12554](https://github.com/quarto-dev/quarto-cli/pull/12554)): CSS properties `font-weight` and `font-style` are translated to Typst `text` properties.
3434
- ([#12695](https://github.com/quarto-dev/quarto-cli/issues/12695)): Resolve Typst `font-paths` that start with `/` relative to project root.
3535
- ([#12739](https://github.com/quarto-dev/quarto-cli/pull/12739)): Remove unused variable `heading-background-color` and `heading-decoration` from Typst's templates. They are leftover from previous change, and not part of Brand.yml schema for typography of headings.
36+
- ([#12815](https://github.com/quarto-dev/quarto-cli/issues/12815)): Do not crash when floats have no content.
3637

3738
### `beamer`
3839

src/resources/filters/quarto-post/typst.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function render_typst()
3232
},
3333
{
3434
FloatRefTarget = function(float)
35+
if float.content == nil then
36+
return float
37+
end
3538
if float.content.t == "Table" then
3639
-- this needs the fix from https://github.com/jgm/pandoc/pulls/9778
3740
float.content.classes:insert("typst-no-figure")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Untitled"
3+
format: typst
4+
---
5+
6+
7+
::: {#tbl-mtcars .cell tbl-cap='Head of mtcars'}
8+
9+
:::
10+

0 commit comments

Comments
 (0)