Skip to content

Commit 71bb7dd

Browse files
committed
Merge branch 'main' of github.com:quarto-dev/quarto-cli into main
2 parents d987a8c + b5a8326 commit 71bb7dd

File tree

4 files changed

+233
-8
lines changed

4 files changed

+233
-8
lines changed

src/format/reveal/format-reveal.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,13 @@ function applyStretch(doc: Document, autoStretch: boolean) {
680680
const removeEmpty = function (el: Element) {
681681
const parentEl = el.parentElement;
682682
parentEl?.removeChild(el);
683-
if (parentEl?.innerText.trim() === "") removeEmpty(parentEl);
683+
if (
684+
parentEl?.innerText.trim() === "" &&
685+
// Stop at section leveal and do not remove empty slides
686+
parentEl?.nodeName !== "SECTION"
687+
) {
688+
removeEmpty(parentEl);
689+
}
684690
};
685691

686692
// Figure environment ? Get caption and alignment

src/resources/language/_language-fr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ section-title-reuse: "Réutilisation"
99
section-title-citation: "Citation"
1010

1111
appendix-attribution-bibtex: "BibTeX"
12-
appendix-attribution-cite-as: "Veuillez citer ce travail comme suit :"
12+
appendix-attribution-cite-as: "Veuillez citer ce travail comme suit :"
1313

1414
title-block-author-single: "Auteur"
1515
title-block-author-plural: "Auteurs"
1616
title-block-affiliation-single: "Association"
1717
title-block-affiliation-plural: "Les associations"
18-
title-block-published: "Date De Publication"
18+
title-block-published: "Date de publication"
1919

2020
callout-tip-caption: "Astuce"
2121
callout-note-caption: "Note"
@@ -34,7 +34,7 @@ code-tools-source-code: "Code source"
3434
copy-button-tooltip: "Copier vers le presse-papier"
3535
copy-button-tooltip-success: "Copié"
3636

37-
repo-action-links-edit: "Editer cette page"
37+
repo-action-links-edit: "Modifier cette page"
3838
repo-action-links-source: "Voir la source"
3939
repo-action-links-issue: "Faire part d'un problème"
4040

@@ -70,7 +70,7 @@ environment-remark-title: "Remarque"
7070
environment-solution-title: "Solution"
7171

7272
listing-page-order-by: "Trier par"
73-
listing-page-order-by-default: "Ordre par defaut"
73+
listing-page-order-by-default: "Ordre par défaut"
7474
listing-page-order-by-date-asc: "Le plus ancien"
7575
listing-page-order-by-date-desc: "Le plus récent"
7676
listing-page-order-by-number-desc: "Descendant"

tests/docs/reveal/stretch.qmd

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
---
2+
title: "test stretched"
3+
format:
4+
revealjs:
5+
auto-stretch: true
6+
---
7+
8+
## Insert an image {#simple-image}
9+
10+
Without stretch feature
11+
12+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg)
13+
14+
## Insert an image with code content below {#chunk-below}
15+
16+
Without stretch feature
17+
18+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg)
19+
20+
```{r, echo = TRUE}
21+
1 + 1
22+
```
23+
24+
## Insert an image with no caption {#no-caption}
25+
26+
Without stretch feature
27+
28+
![](https://revealjs.com/images/logo/reveal-black-text.svg)
29+
30+
## Insert an image with height defined {#height-defined}
31+
32+
Without stretch feature
33+
34+
![](https://revealjs.com/images/logo/reveal-black-text.svg){height=50%}
35+
36+
## Insert an image with right alignment {#rigth-aligned}
37+
38+
Without stretch feature
39+
40+
![](https://revealjs.com/images/logo/reveal-black-text.svg){fig-align='right'}
41+
42+
## Insert an image with caption text {#only-image}
43+
44+
![Elephant](https://raw.githubusercontent.com/quarto-dev/quarto-web/main/docs/authoring/elephant.png)
45+
46+
## Column layout {#columns}
47+
48+
:::: {.columns}
49+
50+
::: {.column width="40%"}
51+
On the right a nice elephant
52+
:::
53+
54+
::: {.column width="60%"}
55+
![Elephant](https://raw.githubusercontent.com/quarto-dev/quarto-web/main/docs/authoring/elephant.png)
56+
:::
57+
58+
::::
59+
60+
## Insert an image with alt text {#alt-text}
61+
62+
![](https://raw.githubusercontent.com/quarto-dev/quarto-web/main/docs/authoring/elephant.png){fig-alt="A drawing of an elephant."}
63+
64+
## Insert an image with alt text, caption and title {#caption-title}
65+
66+
![Elephant](https://raw.githubusercontent.com/quarto-dev/quarto-web/main/docs/authoring/elephant.png "Title: An elephant"){fig-alt="A drawing of an elephant."}
67+
68+
## Insert an image specifying `.strech` explicitly (no caption) {#with-class-no-caption}
69+
70+
With adding stretch feature
71+
72+
![](https://revealjs.com/images/logo/reveal-black-text.svg){.stretch}
73+
74+
## Insert an image specifying `.strech` explicitly (with caption) {#with-class-caption}
75+
76+
Using the `.strech` class
77+
78+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg){.stretch}
79+
80+
## No strech when more than one image {#more-than-one}
81+
82+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg)
83+
84+
And another
85+
86+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg)
87+
88+
## No stretch when `.nostretch` is used at slide level {.nostretch #no-stretch-class}
89+
90+
![revealjs logo](https://revealjs.com/images/logo/reveal-black-text.svg)
91+
92+
## Using knitr to create a plot {#knitr-plot}
93+
94+
```{r, echo = TRUE, fig.cap = "Knitr figure"}
95+
plot(cars)
96+
```
97+
98+
## Using knitr to create a plot without echo {#knitr-plot-no-echo}
99+
100+
```{r, echo = FALSE, fig.cap = "Knitr figure"}
101+
plot(cars)
102+
```
103+
104+
## Using knitr to create a plot with other text {#knitr-and-text}
105+
106+
```{r, echo = FALSE, fig.cap = "Knitr figure"}
107+
plot(cars)
108+
```
109+
110+
On this plot, we have interesting informations.
111+
112+
## Using knitr to specify alignement {#knitr-align}
113+
114+
```{r, echo = FALSE, fig.cap = "Knitr figure", fig.align='right'}
115+
plot(cars)
116+
```
117+
118+
## Using knitr to specify height {#knitr-height}
119+
120+
```{r, echo = FALSE, fig.cap = "Knitr figure", out.height="120px"}
121+
plot(cars)
122+
```
123+
124+
## Using knitr to specify height in % {#knitr-height-pct}
125+
126+
```{r, echo = FALSE, fig.cap = "Knitr figure", out.height="50%"}
127+
plot(cars)
128+
```
129+
130+
## Using knitr without caption {#knitr-no-caption-and-content}
131+
132+
```{r, echo = FALSE}
133+
plot(cars)
134+
```
135+
136+
```{r}
137+
1 + 1
138+
```
139+
140+
## Inline images {#inline-image}
141+
142+
And how does it works with inline images like ![](https://revealjs.com/images/logo/reveal-black-text.svg)
143+
144+
## Using block layout {#block-layout}
145+
146+
::: {layout-ncol=2}
147+
148+
- Item A
149+
- Item B
150+
- Item C
151+
152+
![](https://revealjs.com/images/logo/reveal-black-text.svg)
153+
:::
154+
155+
## Using block layout 2 {#block-layout2}
156+
157+
::: {layout-ncol=2}
158+
### List One
159+
160+
- Item A
161+
- Item B
162+
- Item C
163+
164+
### Image
165+
166+
![](https://revealjs.com/images/logo/reveal-black-text.svg)
167+
:::
168+
169+
## Using figure table layout {#fig-tab-layout}
170+
171+
```{r}
172+
#| layout-ncol: 2
173+
174+
library(knitr)
175+
kable(head(cars), caption = "Cars")
176+
plot(cars)
177+
```
178+
179+
## {#no-content}
180+
181+
![](https://revealjs.com/images/logo/reveal-black-text.svg)
182+
183+
## {#no-content-caption}
184+
185+
![A logo](https://revealjs.com/images/logo/reveal-black-text.svg)

tests/smoke/render/render-reveal.test.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import { testRender } from "./render.ts";
1212
// demo file renders ok
1313
testRender(docs("reveal/index.qmd"), "revealjs", false);
1414

15-
// aside and footnotes correctly moved with speaker notes ignored
16-
const input = docs("reveal/aside-footnotes.qmd");
17-
const output = outputForInput(input, "revealjs");
15+
let input = docs("reveal/aside-footnotes.qmd");
16+
let output = outputForInput(input, "revealjs");
1817
testRender(input, "revealjs", false, [
1918
ensureHtmlElements(output.outputPath, [
2019
// speaker notes are left not moved
@@ -28,3 +27,38 @@ testRender(input, "revealjs", false, [
2827
"section#slide-with-footnotes > aside:last-child > ol.aside-footnotes > li > .footnote-back",
2928
]),
3029
]);
30+
31+
// auto-stretch feature
32+
input = docs("reveal/stretch.qmd");
33+
output = outputForInput(input, "revealjs");
34+
testRender(input, "revealjs", false, [
35+
ensureHtmlElements(output.outputPath, [
36+
"#simple-image > p + img.r-stretch",
37+
"#chunk-below > p + img.r-stretch + p.caption + div.cell",
38+
"#no-caption > p + img.r-stretch",
39+
"#height-defined img:not(.r-stretch)",
40+
"#rigth-aligned > p + img.r-stretch.quarto-figure-right",
41+
"#only-image > img.r-stretch + p.caption",
42+
"#alt-text > img.r-stretch[alt]",
43+
"#caption-title > img.r-stretch[title] + p.caption",
44+
"#with-class-no-caption > img.stretch",
45+
"#with-class-caption > img.stretch.quarto-figure-center + p.caption",
46+
"#knitr-plot > div.cell + img.r-stretch + p.caption",
47+
"#knitr-plot-no-echo > img.r-stretch + p.caption",
48+
"#knitr-and-text > img.r-stretch + p.caption + p",
49+
"#knitr-align > img.r-stretch.quarto-figure-right + p.caption",
50+
"#knitr-no-caption-and-content > img.r-stretch + div.cell",
51+
"#no-content > img.r-stretch",
52+
"#no-content-caption > img.r-stretch + p.caption",
53+
], [
54+
"#columns img.r-stretch",
55+
"#more-than-one img.r-stretch",
56+
"section#no-stretch-class.nostretch img.r-stretch",
57+
"#knitr-height img.r-stretch",
58+
"#knitr-height-pct img.r-stretch",
59+
"#inline-image img.r-stretch",
60+
"#block-layout img.r-stretch",
61+
"#block-layout2 img.r-stretch",
62+
"#fig-tab-layout img.r-stretch",
63+
]),
64+
]);

0 commit comments

Comments
 (0)