quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.89k stars 320 forks source link

FATAL error in confluence publish with multi columns figures #9507

Closed fkgruber closed 5 months ago

fkgruber commented 6 months ago

Bug description

If you try to publish a quarto document that has mutlticolumns (::: {layout-ncol=2} notation) it crashes with fatal error.

Even if multicolumn are not supported in confluence it should not just crash with fatal error. Hopefully it would do something sensible.

Steps to reproduce

---
format: confluence-html
title: Test
author: Test
---
# Test 2 columns
```{r}
library(tidyverse)

::: {layout-ncol=2}

#| echo: false
#| eval: true
#| cache: true
#| fig.asp: 1
#| messages: false
#| warnings: false
#| fig.width: 10

hist(rnorm(1000))
#| echo: false
#| eval: true
#| cache: true
#| fig.asp: 1
#| messages: false
#| warnings: false
#| fig.width: 10

hist(rnorm(100))

Test of 2

:::



quarto publish confluence bug_confluence.qmd 

### Expected behavior

to publish in confluence

### Actual behavior

crashes with

> 
> >FATAL (/Applications/quarto/share/filters/main.lua:20159) An error occurred:
> This is an internal error. Please file a bug report at https://github.com/quarto-dev/quarto-cli/
> Error running filter /Applications/quarto/share/filters/main.lua:
> /Applications/quarto/share/filters/main.lua:2246: attempt to call a nil value (global 'crash_with_stack_trace')
> stack traceback:
>   /Applications/quarto/share/filters/main.lua:1826: in function 'fail'
>   /Applications/quarto/share/filters/main.lua:1831: in function 'internal_error'
>   /Applications/quarto/share/filters/main.lua:20159: in function 'decorate_caption_with_crossref'
>   /Applications/quarto/share/filters/main.lua:21385: in field 'render'
>   /Applications/quarto/share/filters/main.lua:841: in local 'filter_fn'
>   /Applications/quarto/share/filters/main.lua:302: in function </Applications/quarto/share/filters/main.lua:292>
>   (...tail calls...)
>   [C]: in ?
>   [C]: in method 'walk'
>   /Applications/quarto/share/filters/main.lua:224: in function </Applications/quarto/share/filters/main.lua:214>
>   (...tail calls...)
>   /Applications/quarto/share/filters/main.lua:942: in local 'callback'
>   /Applications/quarto/share/filters/main.lua:960: in upvalue 'run_emulater_chain'
>   /Applications/quarto/share/filters/main.lua:996: in function </Applications/quarto/share/filters/main.lua:993>
> stack traceback:
>   /Applications/quarto/share/filters/main.lua:224: in function </Applications/quarto/share/filters/main.lua:214>
>   (...tail calls...)
>   /Applications/quarto/share/filters/main.lua:942: in local 'callback'
>   /Applications/quarto/share/filters/main.lua:960: in upvalue 'run_emulated_filter_chain'
>   /Applications/quarto/share/filters/main.lua:996: in function </Applications/quarto/share/filters/main.lua:993>

### Your environment

OS: Mac OS Sonoma 14.4

### Quarto check output

Quarto 1.4.553
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.553
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2023

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.8 (Conda)
      Path: /Users/fgruber/miniconda3/bin/python
      Jupyter: 5.5.0
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
      knitr: 1.45
      rmarkdown: 2.26.1

[✓] Checking Knitr engine render......OK
mcanouil commented 6 months ago

Are tidyverse and all the options you've set necessary? By the way, Quarto uses dash delimited code cell options: fig-asp not fig.asp (even if it works).

Is the following enough to produce the issue you are describing?

---
format: confluence-html
title: Test
author: Test
---

## Test 2 columns

::: {layout-ncol=2}

Text 1

Text 2

Text 3

:::
fkgruber commented 6 months ago

yes this minimal example works fine to reproduce error.

thanks

fkgruber commented 6 months ago

by the way I got the same error on a linux machine. So it is not mac specific either.

cscheid commented 6 months ago

Thanks for the report. From the error trace, this looks like another instance of the stray nils we're getting from Pandoc given their recent Lua API fix in https://github.com/jgm/pandoc/issues/9613.

cscheid commented 5 months ago

Ok, I can repro this. Unfortunately, the fix is to produce an error message that says "Confluence format can't render layouts without floats"; This is because multi-column layouts are simply not supported by Confluence.

cscheid commented 5 months ago

The error will now be

ERROR (/Users/cscheid/repos/github/quarto-dev/quarto-cli/src/resources/filters/./layout/confluence.lua:61) Confluence format can't render layouts without floats. Will skip this layout element.