Skip to content

Commit ad0a7da

Browse files
authored
Merge pull request #12728 from quarto-dev/bugfix/12727
lua - do not crash in the presence of malformed tabset contents
2 parents 9180b54 + fafd446 commit ad0a7da

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

news/changelog-1.8.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ All changes included in 1.8:
3535
## Crossrefs
3636

3737
- ([#12615](https://github.com/quarto-dev/quarto-cli/pull/12615)): Adds `algorithm` to theorem environments. (author: @jeremy9959)
38+
39+
## Lua Filters
40+
41+
- ([#12727](https://github.com/quarto-dev/quarto-cli/issues/12727)): Do not crash in the presence of malformed tabset contents.

src/resources/filters/customnodes/panel-tabset.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ _quarto.ast.add_handler({
146146

147147
constructor = function(params)
148148
local node = _quarto.ast.create_custom_node_scaffold("Tabset", "Block")
149+
if params.tabs == nil then
150+
warn("No tabs found in tabset. Please check that your markdown includes tab headings as appropriate.")
151+
params.tabs = pandoc.List()
152+
end
149153

150154
local custom_data = {
151155
__quarto_custom_node = node,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "Geographic data analysis in R and Python: comparing code and outputs for vector data"
3+
---
4+
5+
::: {.panel-tabset group="language"}
6+
7+
## Python
8+
9+
```python
10+
print("ok")
11+
```
12+
13+
## R
14+
15+
```r
16+
print("hello")
17+
```
18+
19+
:::
20+
21+
::: {.panel-tabset group="language"}
22+
23+
## Python
24+
25+
```python
26+
print("Missing the headers here but we shouldn't crash")
27+
```
28+
29+
## R
30+
31+
```r
32+
cat("hello")
33+
```
34+
35+
:::

0 commit comments

Comments
 (0)