Skip to content

Commit 3dd256b

Browse files
committed
Merge branch 'main' of github.com:quarto-dev/quarto-cli into main
2 parents 45117af + 2dd6769 commit 3dd256b

File tree

6 files changed

+70
-9
lines changed

6 files changed

+70
-9
lines changed

news/changelog-1.1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
## Code Blocks
3838

3939
- Support `filename` attribute for attaching a file name header to code blocks
40+
- Improve YAML parse error messages in `r` code blocks using `!expr` YAML (#1949)
4041

4142
## OJS
4243

@@ -48,6 +49,7 @@
4849
- Hide declarations in hugo format (#1812)
4950
- Enable OJS runtime in the presence of `ojs_define` (#1846)
5051
- Emit subcaptions correctly (#1711)
52+
- Use forward slashes in paths so OJS compilation works on windows (#1605)
5153

5254
## Websites
5355

src/core/lib/yaml-intelligence/annotated-yaml.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { AnnotatedParse, JSONValue } from "../yaml-schema/types.ts";
1111
import {
1212
asMappedString,
1313
mappedIndexToLineCol,
14+
mappedLines,
1415
MappedString,
1516
} from "../mapped-text.ts";
1617
import { getTreeSitterSync } from "./parsing.ts";
@@ -19,6 +20,7 @@ import { load as jsYamlParse } from "../external/js-yaml.js";
1920

2021
import { QuartoJSONSchema } from "./js-yaml-schema.ts";
2122
import { createSourceContext } from "../yaml-validation/errors.ts";
23+
import { tidyverseInfo } from "../errors.ts";
2224

2325
// deno-lint-ignore no-explicit-any
2426
type TreeSitterParse = any;
@@ -64,10 +66,13 @@ export function readAnnotatedYamlFromMappedString(
6466
try {
6567
return buildJsYamlAnnotation(mappedSource);
6668
} catch (e) {
69+
// FIXME we should convert this to a TidyverseError
70+
// for now, we just use the util functions.
6771
const m = e.stack.split("\n")[0].match(/^.+ \((\d+):(\d+)\)$/);
6872
if (m) {
6973
const f = lineColToIndex(mappedSource.value);
70-
const offset = f({ line: Number(m[1]) - 1, column: Number(m[2] - 1) });
74+
const location = { line: Number(m[1]) - 1, column: Number(m[2] - 1) };
75+
const offset = f(location);
7176
const { originalString } = mappedSource.map(offset, true)!;
7277
const filename = originalString.fileName!;
7378
const f2 = mappedIndexToLineCol(mappedSource);
@@ -80,6 +85,22 @@ export function readAnnotatedYamlFromMappedString(
8085
column + 1
8186
})\n${sourceContext}`;
8287
e.message = e.stack;
88+
if (
89+
mappedLines(mappedSource)[location.line].value.indexOf("!expr") !==
90+
-1 &&
91+
e.reason.match(/bad indentation of a mapping entry/)
92+
) {
93+
e.message = `${e.message}\n${
94+
tidyverseInfo(
95+
"YAML tags like !expr must be followed by YAML strings.",
96+
)
97+
}\n${
98+
tidyverseInfo(
99+
"Is it possible you need to quote the value you passed to !expr ?",
100+
)
101+
}`;
102+
}
103+
83104
e.stack = "";
84105
}
85106
throw e;

src/resources/editor/tools/vs-code.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19893,6 +19893,10 @@ function mappedIndexToLineCol(eitherText) {
1989319893
return indexToLineCol(originalString.value)(index);
1989419894
};
1989519895
}
19896+
function mappedLines(str2, keepNewLines = false) {
19897+
const lines2 = rangedLines(str2.value, keepNewLines);
19898+
return lines2.map((v) => mappedString(str2, [v.range]));
19899+
}
1989619900

1989719901
// parsing.ts
1989819902
var _parser;
@@ -25509,7 +25513,8 @@ function readAnnotatedYamlFromMappedString(mappedSource2) {
2550925513
const m = e.stack.split("\n")[0].match(/^.+ \((\d+):(\d+)\)$/);
2551025514
if (m) {
2551125515
const f = lineColToIndex(mappedSource2.value);
25512-
const offset = f({ line: Number(m[1]) - 1, column: Number(m[2] - 1) });
25516+
const location = { line: Number(m[1]) - 1, column: Number(m[2] - 1) };
25517+
const offset = f(location);
2551325518
const { originalString } = mappedSource2.map(offset, true);
2551425519
const filename = originalString.fileName;
2551525520
const f2 = mappedIndexToLineCol(mappedSource2);
@@ -25521,6 +25526,11 @@ function readAnnotatedYamlFromMappedString(mappedSource2) {
2552125526
e.stack = `${e.reason} (${filename}, ${line + 1}:${column + 1})
2552225527
${sourceContext}`;
2552325528
e.message = e.stack;
25529+
if (mappedLines(mappedSource2)[location.line].value.indexOf("!expr") !== -1 && e.reason.match(/bad indentation of a mapping entry/)) {
25530+
e.message = `${e.message}
25531+
${tidyverseInfo("YAML tags like !expr must be followed by YAML strings.")}
25532+
${tidyverseInfo("Is it possible you need to quote the value you passed to !expr ?")}`;
25533+
}
2552425534
e.stack = "";
2552525535
}
2552625536
throw e;

src/resources/editor/tools/yaml/web-worker.js

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/projects/website/navigation/quarto-nav.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,32 @@ header.headroom--unpinned {
5959
}
6060

6161
.navbar-brand {
62-
text-overflow: ellipsis;
6362
overflow: hidden;
63+
text-overflow: ellipsis;
64+
}
65+
66+
.navbar-brand-container {
6467
max-width: calc(100% - 85px);
68+
min-width: 0;
69+
display: flex;
70+
align-items: center;
71+
margin-right: 1em;
72+
}
73+
74+
.navbar-brand.navbar-brand-logo {
75+
margin-right: 4px;
76+
display: inline-flex;
6577
}
6678

6779
.navbar-toggler {
6880
flex-basis: content;
6981
flex-shrink: 0;
7082
}
7183

72-
.navbar-brand > img {
84+
.navbar-logo {
7385
max-height: 24px;
7486
width: auto;
75-
padding-right: 6px;
87+
padding-right: 4px;
7688
}
7789

7890
nav .nav-item:not(.compact) {
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<% if (navbar.title || navbar.logo) { %>
2-
<a class="navbar-brand" href="<%- navbar['logo-href'] || '/index.html' %>">
2+
<div class="navbar-brand-container">
33
<% if (navbar.logo) { %>
4-
<img src="<%- navbar.logo %>" alt="<%- navbar['logo-alt'] || '' %>" />
4+
<a href="<%- navbar['logo-href'] || '/index.html' %>" class="navbar-brand navbar-brand-logo">
5+
<img src="<%- navbar.logo %>" alt="<%- navbar['logo-alt'] || '' %>" class="navbar-logo" />
6+
</a>
57
<% } %>
8+
9+
610
<% if (navbar.title) { %>
11+
<a class="navbar-brand" href="/index.html">
712
<span class="navbar-title"><%- navbar.title %></span>
13+
</a>
814
<% } %>
9-
</a>
15+
</div>
1016
<% } %>

0 commit comments

Comments
 (0)