Skip to content

Commit 39ae1c4

Browse files
authored
Merge branch 'main' into jk/engine-commands
2 parents 983c60b + c1c5a43 commit 39ae1c4

File tree

19 files changed

+51
-38
lines changed

19 files changed

+51
-38
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ All changes included in 1.7:
8080
- Fix `pandoc.mediabag` Lua typings so autocompletions work with the Lua LSP integration.
8181
- ([#11896](https://github.com/quarto-dev/quarto-cli/pull/11896)): fix `\f` (`{{< pagebreak >}}`) form feed character not valid in PowerPoint (`pptx`).
8282
- ([#11664](https://github.com/quarto-dev/quarto-cli/issues/11664)): `lipsum` shortcode is no longer randomly generated by default, use `{{< lipsum random=true >}}` to restore randomness.
83+
- ([#11379](https://github.com/quarto-dev/quarto-cli/issues/11379)): Add `version` shortcode to display the current Quarto version.
8384

8485
## Engines
8586

src/core/log.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,14 @@ Please consider reporting it at https://github.com/quarto-dev/quarto-cli. Thank
344344
if (!message) {
345345
message = err.stack;
346346
} else {
347-
message = message + "\n\nStack trace:\n" +
348-
err.stack.split("\n").slice(1).join("\n");
347+
const stackLines = err.stack.split("\n");
348+
const firstAtLineIndex = stackLines.findIndex((line) =>
349+
/^\s*at /.test(line)
350+
);
351+
if (firstAtLineIndex !== -1) {
352+
const stackTrace = stackLines.slice(firstAtLineIndex).join("\n");
353+
message = message + "\n\nStack trace:\n" + stackTrace;
354+
}
349355
}
350356
}
351357

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: Version
2+
author: Posit, PBC
3+
organization: quarto
4+
contributes:
5+
shortcodes:
6+
- version.lua
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
return {
2+
['version'] = function(args, kwargs, meta)
3+
return table.concat(quarto.version, '.')
4+
end
5+
}

src/resources/filters/crossref/refs.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function resolveRefs()
1313
local function add_ref_prefix(ref, ref_type, prefix)
1414
local category = crossref.categories.by_ref_type[ref_type]
1515
ref:extend(prefix)
16-
if category == nil or category.space_before_numbering ~= false then
16+
if (category == nil or category.space_before_numbering ~= false) and not _quarto.format.isTypstOutput() then
1717
ref:extend({nbspString()})
1818
end
1919
end
@@ -82,12 +82,13 @@ function resolveRefs()
8282
-- so we don't get the fallthrough else clause in latex when custom ref commands
8383
-- are in play
8484
if category == nil or category.custom_ref_command == nil then
85-
ref:extend({pandoc.RawInline('latex', '\\ref{' .. label .. '}')})
85+
ref:extend(pandoc.List({pandoc.RawInline('latex', '\\ref{' .. label .. '}')}))
8686
end
8787
elseif _quarto.format.isAsciiDocOutput() then
8888
ref = pandoc.List({pandoc.RawInline('asciidoc', '<<' .. label .. '>>')})
8989
elseif _quarto.format.isTypstOutput() then
90-
ref = pandoc.List({pandoc.RawInline('typst', '@' .. label)})
90+
ref:insert(1, pandoc.RawInline('typst', '#ref(<' .. label .. '>, supplement: ['))
91+
ref:insert(pandoc.RawInline('typst', '])'))
9192
else
9293
if not resolve then
9394
local refClasses = pandoc.List({"quarto-unresolved-ref"})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
format: html
3+
_quarto:
4+
tests:
5+
html:
6+
ensureFileRegexMatches:
7+
- ["Quarto [0-9]+\\.[0-9]+\\.[0-9]+ is amazing"]
8+
---
9+
10+
Quarto {{< version >}} is amazing.

tests/docs/smoke-all/crossrefs/float/typst/rawtablecaption.qmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ _quarto:
88
ensureTypstFileRegexMatches:
99
-
1010
- "This is a caption."
11-
- "<tbl-1>"
12-
- "@tbl-1"
11+
- "#ref\\(<tbl-1>, supplement: \\[Table\\]\\)"
1312
- []
1413
---
1514

tests/docs/smoke-all/crossrefs/float/typst/typst-float-1.qmd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ _quarto:
77
typst:
88
ensureTypstFileRegexMatches:
99
-
10-
- "<tbl-1>"
11-
- "<fig-1>"
12-
- "@fig-1"
13-
- "@tbl-1"
10+
- "#ref\\(<fig-1>, supplement: \\[Figure\\]\\)"
11+
- "#ref\\(<tbl-1>, supplement: \\[Table\\]\\)"
1412
- []
1513
---
1614

tests/docs/smoke-all/crossrefs/float/typst/typst-float-2.qmd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ _quarto:
77
typst:
88
ensureTypstFileRegexMatches:
99
-
10-
- "<fig-foo>"
11-
- "<tbl-foo>"
12-
- "@fig-foo"
13-
- "@tbl-foo"
10+
- "#ref\\(<fig-foo>, supplement: \\[Figure\\]\\)"
11+
- "#ref\\(<tbl-foo>, supplement: \\[Table\\]\\)"
1412
- "This is the figure"
1513
- "This is the table"
1614
---

tests/docs/smoke-all/crossrefs/float/typst/typst-float-3.qmd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ _quarto:
77
typst:
88
ensureTypstFileRegexMatches:
99
-
10-
- "<fig-foo>"
11-
- "<tbl-foo>"
12-
- "@fig-foo"
13-
- "@tbl-foo"
10+
- "#ref\\(<fig-foo>, supplement: \\[Figure\\]\\)"
11+
- "#ref\\(<tbl-foo>, supplement: \\[Table\\]\\)"
1412
- "This is a figure"
1513
- "This is a table"
1614
---

0 commit comments

Comments
 (0)