Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ _quarto:
- "a[href=\"#tbl-2\"].quarto-xref"
dashboard: *dom-tests
revealjs: # reveal resolves anchors differently, using the section headings instead of the float ids
ensureHtmlElements:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a head up that fixing this is breaking the feature format matrix test
https://github.com/quarto-dev/quarto-cli/actions/runs/9423620780/job/25962387025#step:26:214

So I don't know if revealjs is just not well supported here, or something else but this is probably to fix in another issue.

This PR just surfaced it as previously there was no test, and it was silently not testing

-
- "div#tbl-1.quarto-float figure.quarto-float.quarto-float-tbl table"
- "div#tbl-2.quarto-float figure.quarto-float.quarto-float-tbl img"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ format:
typst:
quality: 2
comment: "Typst itself interprets the -- as –"
output-ext: typ
keep-typ: true
revealjs:
quality: 1
docx:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ format:
dashboard:
quality: 1
typst:
output-ext: typ
keep-typ: true
quality: 2
revealjs:
quality: 1
Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/quarto-post/latex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ function render_latex_fixups()
if _quarto.format.isRawLatex(raw) then
local long_table_match = _quarto.modules.patterns.match_all_in_table(_quarto.patterns.latexLongtablePattern)
local caption_match = _quarto.modules.patterns.match_all_in_table(_quarto.patterns.latexCaptionPattern)
if long_table_match(raw.text) and caption_match(raw.text) then
if long_table_match(raw.text) and not caption_match(raw.text) then
raw.text = raw.text:gsub(
_quarto.modules.patterns.combine_patterns(_quarto.patterns.latexLongtablePattern), "\\begin{longtable*}%2\\end{longtable*}", 1)
return raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ format: docusaurus-md
_quarto:
tests:
docusaurus-md:
ensure-snapshot-matches: true
ensureSnapshotMatches: true
---

::: {.panel-tabset}
Expand Down
2 changes: 1 addition & 1 deletion tests/docs/smoke-all/2024/02/13/empty-floats.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ format: latex
_quarto:
tests:
latex:
verifyNoErrors: true
noErrors: true
---

:::{#fig-1}
Expand Down
5 changes: 3 additions & 2 deletions tests/docs/smoke-all/2024/03/22/8998.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ engine: jupyter
_quarto:
tests:
revealjs:
- []
- ["python"]
ensureFileRegexMatches:
- []
- ["python"]
---

- Turn off alarm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crossref:
_quarto:
tests:
jats:
ensureJatsXPath:
ensureJatsXpath:
- []
-
- "//xref[@rid=\"tbl-letters\"]"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
format: pdf
keep-tex: true
title: "Long Table kable fixups etc"
_quarto:
tests:
pdf:
ensureLatexFileRegexMatches:
- ['\\begin\{longtable\}']
- []
---

## Raw longtable table with no crossref and caption from kable function

In this case we'll issue a warning about of the type
````
Raw LaTeX table found with non-tbl label: tab:not-tbl
Won't be able to cross-reference this table using Quarto's native crossref system.
````
```{r}
#| label: not-tbl
#| echo: false
df <- tibble::tibble(
x = 1:20,
y = rnorm(20),
z = rnorm(20)
)
knitr::kable(df,
format = "latex",
longtable = TRUE,
booktabs = TRUE,
caption = "A long table with a caption")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
format: pdf
keep-tex: true
title: "Long Table kable fixups etc"
_quarto:
tests:
pdf:
ensureLatexFileRegexMatches:
- ['\\begin\{longtable\*\}']
- ['\\begin\{longtable\}']
---

## Raw longtable table with no crossref and no caption

In this case, Quarto will transform to longtable*

```{r}
#| echo: false
df <- tibble::tibble(
x = 1:20,
y = rnorm(20),
z = rnorm(20)
)
knitr::kable(df,
format = "latex",
longtable = TRUE,
booktabs = TRUE)
```

2 changes: 1 addition & 1 deletion tests/docs/smoke-all/crossrefs/theorem/lemma-1.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
format:
typst:
output-ext: typ
keep-typ: true
_quarto:
tests:
html:
Expand Down
2 changes: 1 addition & 1 deletion tests/docs/smoke-all/crossrefs/theorem/theorem-1.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
format:
typst:
output-ext: typ
keep-typ: true
_quarto:
tests:
html:
Expand Down
2 changes: 1 addition & 1 deletion tests/docs/smoke-all/crossrefs/theorem/theorem-2.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
format:
typst:
output-ext: typ
keep-typ: true
_quarto:
tests:
html:
Expand Down
16 changes: 15 additions & 1 deletion tests/smoke/smoke-all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ensurePptxXpath,
ensurePptxLayout,
ensurePptxMaxSlides,
ensureLatexFileRegexMatches,
} from "../verify.ts";
import { readYaml, readYamlFromMarkdown } from "../../src/core/yaml.ts";
import { outputForInput } from "../utils.ts";
Expand Down Expand Up @@ -96,6 +97,7 @@ function resolveTestSpecs(
const verifyMap: Record<string, any> = {
ensureHtmlElements,
ensureFileRegexMatches,
ensureLatexFileRegexMatches,
ensureTypstFileRegexMatches,
ensureDocxRegexMatches,
ensureDocxXpath,
Expand All @@ -112,7 +114,7 @@ function resolveTestSpecs(
for (const [format, testObj] of Object.entries(specs)) {
let checkWarnings = true;
const verifyFns: Verify[] = [];
if (testObj) {
if (testObj && typeof testObj === "object") {
for (
// deno-lint-ignore no-explicit-any
const [key, value] of Object.entries(testObj as Record<string, any>)
Expand Down Expand Up @@ -150,11 +152,23 @@ function resolveTestSpecs(
verifyFns.push(verifyMap[key](outputFile.outputPath, ...value));
}
} else if (verifyMap[key]) {
// FIXME: We should find another way that having this requirement of keep-* in the metadata
if (key === "ensureTypstFileRegexMatches") {
if (!metadata.format?.typst?.['keep-typ'] && !metadata['keep-typ']) {
throw new Error(`Using ensureTypstFileRegexMatches requires setting 'keep-typ: true' in file ${input}`);
}
} else if (key === "ensureLatexFileRegexMatches") {
if (!metadata.format?.pdf?.['keep-tex'] && !metadata['keep-tex']) {
throw new Error(`Using ensureLatexFileRegexMatches requires setting 'keep-tex: true' in file ${input}`);
}
}
if (typeof value === "object") {
verifyFns.push(verifyMap[key](outputFile.outputPath, ...value));
} else {
verifyFns.push(verifyMap[key](outputFile.outputPath, value));
}
} else {
throw new Error(`Unknown verify function used: ${key} in file ${input} for format ${format}`) ;
}
}
}
Expand Down
Loading