Skip to content

Commit 3753247

Browse files
authored
Merge pull request #9396 from quarto-dev/bugfix/9356-b
html,websites - Don't change column classes in about
2 parents e970a16 + 36d308f commit 3753247

File tree

8 files changed

+67
-2
lines changed

8 files changed

+67
-2
lines changed

news/changelog-1.5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ All changes included in 1.5:
4141
- ([#8830](https://github.com/quarto-dev/quarto-cli/issues/8830)): Add support for `tools-collapse` to control whether the tools collapse when the navbar does.
4242
- ([#8851](https://github.com/quarto-dev/quarto-cli/issues/8851)): Don't strip `index.html` from external paths.
4343
- ([#8977](https://github.com/quarto-dev/quarto-cli/issues/8977)): Don't decorate about links within external link icons.
44+
- ([#9356](https://github.com/quarto-dev/quarto-cli/issues/9356)): Don't process column classes for figures inside the About divs.
4445

4546
## Book
4647

src/format/html/format-html-bootstrap.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,13 @@ const figCapInCalloutMarginProcessor: MarginNodeProcessor = {
14611461

14621462
const kPreviewFigColumnForwarding = [".grid"];
14631463

1464+
const isInsideAbout = (el: Element) =>
1465+
!!findParent(
1466+
el,
1467+
(parent) =>
1468+
Array.from(parent.classList).some((x) => x.startsWith("quarto-about-")),
1469+
);
1470+
14641471
const processFigureOutputs = (doc: Document) => {
14651472
// For any non-margin figures, we want to actually place the figure itself
14661473
// into the column, and leave the caption as is, if possible
@@ -1497,13 +1504,19 @@ const processFigureOutputs = (doc: Document) => {
14971504

14981505
// If there is a single figure, then forward the column class onto that
14991506
const figures = columnEl.querySelectorAll("figure img.figure-img");
1500-
if (figures && figures.length === 1) {
1507+
1508+
if (
1509+
figures && figures.length === 1 && !isInsideAbout(figures[0] as Element)
1510+
) {
15011511
moveColumnClasses(columnEl, figures[0] as Element);
15021512
} else {
15031513
const layoutFigures = columnEl.querySelectorAll(
15041514
".quarto-layout-panel > figure.figure .quarto-layout-row",
15051515
);
1506-
if (layoutFigures && layoutFigures.length === 1) {
1516+
if (
1517+
layoutFigures && layoutFigures.length === 1 &&
1518+
!isInsideAbout(layoutFigures[0] as Element)
1519+
) {
15071520
moveColumnClasses(columnEl, layoutFigures[0] as Element);
15081521
}
15091522
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.quarto/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Reprex"
6+
navbar:
7+
logo: "https://quarto.org/quarto.png"
8+
right:
9+
- about.qmd
10+
- icon: github
11+
href: https://github.com/
12+
- icon: twitter
13+
href: https://twitter.com
14+
sidebar:
15+
logo: "https://quarto.org/quarto.png"
16+
format:
17+
html:
18+
theme: cosmo
19+
css: styles.css
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Home"
3+
comments: false
4+
about:
5+
id: about-pec
6+
template: solana
7+
_quarto:
8+
tests:
9+
html:
10+
ensureHtmlElements:
11+
- ["div.quarto-about-solana.column-body"]
12+
---
13+
14+
::: {#about-pec}
15+
16+
![a pic](https://quarto.org/quarto.png)
17+
18+
Some text here.
19+
20+
:::
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Reprex"
3+
page-layout: full
4+
title-block-banner: true
5+
---
6+
7+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* css styles */

tests/smoke/smoke-all.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,7 @@ function findProjectOutputDir(input: string) {
280280
if (type === "book") {
281281
return "_book";
282282
}
283+
if (type === "website") {
284+
return (yaml as any)?.project?.["output-dir"] || "_site";
285+
}
283286
}

0 commit comments

Comments
 (0)