Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua, PanelLayout - don't create a div if preamble is empty #11999

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ All changes included in 1.7:
- ([#11578](https://github.com/quarto-dev/quarto-cli/issues/11578)): Typst column layout widths use fractional `fr` units instead of percent `%` units for unitless and default widths in order to fill the enclosing block and not spill outside it.
- ([#11676](https://github.com/quarto-dev/quarto-cli/pull/11676)): Convert unitless image widths from pixels to inches for column layouts.
- ([#11835](https://github.com/quarto-dev/quarto-cli/issues/11835)): Take markdown structure into account when detecting minimum heading level.
- ([#11964](https://github.com/quarto-dev/quarto-cli/issues/11964)): Using panel layout without a crossref label now correctly do not add an empty `#block[]` that was leading to an unnecessary space in output.

## Lua Filters and extensions

Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/customnodes/panellayout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _quarto.ast.add_handler({
tbl.attributes = as_plain_table(tbl.attr.attributes)
tbl.attr = nil
end
tbl.preamble = pandoc.Div(tbl.preamble)
tbl.preamble = not _quarto.utils.is_empty_node(tbl.preamble) and pandoc.Div(tbl.preamble) or nil
end
-- compute vertical alignment and remove attribute
if tbl.attributes == nil then
Expand Down
25 changes: 25 additions & 0 deletions tests/docs/smoke-all/2025/01/31/11964.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: No empty preamble in layout panel
format:
html: default
typst:
keep-typ: true
_quarto:
tests:
html:
ensureFileRegexMatches:
- []
- ['<div>\s*</div>\s*<div class="quarto-layout-panel"']
typst:
ensureTypstFileRegexMatches:
- []
- ['#block\[\s*\]']
---

:::{layout-ncol=2}

Test 1

Test 2

:::