Skip to content

Commit 4ee26df

Browse files
authored
Merge pull request #11646 from quarto-dev/bugfix/improve-brand-defaults-validation
Bugfix/improve brand defaults validation
2 parents 13b55fc + d84c7e8 commit 4ee26df

File tree

7 files changed

+205
-16
lines changed

7 files changed

+205
-16
lines changed

src/core/lib/errors.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import * as colors from "./external/colors.ts";
1010
import { MappedString } from "./text-types.ts";
1111
import { ErrorLocation, TidyverseError } from "./errors-types.ts";
12-
import { isWindows } from "../../deno_ral/platform.ts";
1312

1413
// tidyverse error message styling
1514
// https://style.tidyverse.org/error-messages.html
@@ -25,9 +24,19 @@ import { isWindows } from "../../deno_ral/platform.ts";
2524

2625
function platformHasNonAsciiCharacters(): boolean {
2726
try {
28-
return !isWindows;
27+
// we can't import from deno_ral directly here
28+
// because it's outside of core/lib, which
29+
// gets imported by code that runs in the browser
30+
//
31+
// Then, we need to guard against Deno being undefined
32+
// there as well
33+
return Deno.build.os !== "windows";
2934
} catch (_e) {
30-
return false;
35+
//
36+
// But if deno is undefined, we can assume that we're
37+
// running in the browser, where non-ascii characters
38+
// are supported
39+
return true;
3140
}
3241
}
3342

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

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11839,6 +11839,11 @@ var require_yaml_intelligence_resources = __commonJS({
1183911839
description: "The brand's Mastodon URL."
1184011840
}
1184111841
},
11842+
bluesky: {
11843+
string: {
11844+
description: "The brand's Bluesky URL."
11845+
}
11846+
},
1184211847
github: {
1184311848
string: {
1184411849
description: "The brand's GitHub URL."
@@ -12526,10 +12531,45 @@ var require_yaml_intelligence_resources = __commonJS({
1252612531
ref: "brand-typography"
1252712532
},
1252812533
defaults: {
12534+
ref: "brand-defaults"
12535+
}
12536+
}
12537+
}
12538+
},
12539+
{
12540+
id: "brand-defaults",
12541+
object: {
12542+
properties: {
12543+
bootstrap: {
12544+
ref: "brand-defaults-bootstrap"
12545+
},
12546+
quarto: {
1252912547
schema: "object"
1253012548
}
1253112549
}
1253212550
}
12551+
},
12552+
{
12553+
id: "brand-defaults-bootstrap",
12554+
object: {
12555+
properties: {
12556+
defaults: {
12557+
schema: {
12558+
object: {
12559+
additionalProperties: {
12560+
schema: {
12561+
anyOf: [
12562+
"string",
12563+
"boolean",
12564+
"number"
12565+
]
12566+
}
12567+
}
12568+
}
12569+
}
12570+
}
12571+
}
12572+
}
1253312573
}
1253412574
],
1253512575
"schema/document-about.yml": [
@@ -21782,6 +21822,7 @@ var require_yaml_intelligence_resources = __commonJS({
2178221822
"Important links for the brand, including social media links. If a\nsingle string, it is the brand\u2019s home page or website. Additional fields\nare allowed for internal use.",
2178321823
"The brand\u2019s home page or website.",
2178421824
"The brand\u2019s Mastodon URL.",
21825+
"The brand\u2019s Bluesky URL.",
2178521826
"The brand\u2019s GitHub URL.",
2178621827
"The brand\u2019s LinkedIn URL.",
2178721828
"The brand\u2019s Twitter URL.",
@@ -24146,12 +24187,12 @@ var require_yaml_intelligence_resources = __commonJS({
2414624187
mermaid: "%%"
2414724188
},
2414824189
"handlers/mermaid/schema.yml": {
24149-
_internalId: 193475,
24190+
_internalId: 193524,
2415024191
type: "object",
2415124192
description: "be an object",
2415224193
properties: {
2415324194
"mermaid-format": {
24154-
_internalId: 193467,
24195+
_internalId: 193516,
2415524196
type: "enum",
2415624197
enum: [
2415724198
"png",
@@ -24167,7 +24208,7 @@ var require_yaml_intelligence_resources = __commonJS({
2416724208
exhaustiveCompletions: true
2416824209
},
2416924210
theme: {
24170-
_internalId: 193474,
24211+
_internalId: 193523,
2417124212
type: "anyOf",
2417224213
anyOf: [
2417324214
{
@@ -24301,9 +24342,9 @@ var ANSI_PATTERN = new RegExp(
2430124342
// ../errors.ts
2430224343
function platformHasNonAsciiCharacters() {
2430324344
try {
24304-
return !isWindows;
24345+
return Deno.build.os !== "windows";
2430524346
} catch (_e) {
24306-
return false;
24347+
return true;
2430724348
}
2430824349
}
2430924350
function tidyverseInfo(msg) {

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

Lines changed: 45 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/editor/tools/yaml/yaml-intelligence-resources.json

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,6 +4811,11 @@
48114811
"description": "The brand's Mastodon URL."
48124812
}
48134813
},
4814+
"bluesky": {
4815+
"string": {
4816+
"description": "The brand's Bluesky URL."
4817+
}
4818+
},
48144819
"github": {
48154820
"string": {
48164821
"description": "The brand's GitHub URL."
@@ -5498,10 +5503,45 @@
54985503
"ref": "brand-typography"
54995504
},
55005505
"defaults": {
5506+
"ref": "brand-defaults"
5507+
}
5508+
}
5509+
}
5510+
},
5511+
{
5512+
"id": "brand-defaults",
5513+
"object": {
5514+
"properties": {
5515+
"bootstrap": {
5516+
"ref": "brand-defaults-bootstrap"
5517+
},
5518+
"quarto": {
55015519
"schema": "object"
55025520
}
55035521
}
55045522
}
5523+
},
5524+
{
5525+
"id": "brand-defaults-bootstrap",
5526+
"object": {
5527+
"properties": {
5528+
"defaults": {
5529+
"schema": {
5530+
"object": {
5531+
"additionalProperties": {
5532+
"schema": {
5533+
"anyOf": [
5534+
"string",
5535+
"boolean",
5536+
"number"
5537+
]
5538+
}
5539+
}
5540+
}
5541+
}
5542+
}
5543+
}
5544+
}
55055545
}
55065546
],
55075547
"schema/document-about.yml": [
@@ -14754,6 +14794,7 @@
1475414794
"Important links for the brand, including social media links. If a\nsingle string, it is the brand’s home page or website. Additional fields\nare allowed for internal use.",
1475514795
"The brand’s home page or website.",
1475614796
"The brand’s Mastodon URL.",
14797+
"The brand’s Bluesky URL.",
1475714798
"The brand’s GitHub URL.",
1475814799
"The brand’s LinkedIn URL.",
1475914800
"The brand’s Twitter URL.",
@@ -17118,12 +17159,12 @@
1711817159
"mermaid": "%%"
1711917160
},
1712017161
"handlers/mermaid/schema.yml": {
17121-
"_internalId": 193475,
17162+
"_internalId": 193524,
1712217163
"type": "object",
1712317164
"description": "be an object",
1712417165
"properties": {
1712517166
"mermaid-format": {
17126-
"_internalId": 193467,
17167+
"_internalId": 193516,
1712717168
"type": "enum",
1712817169
"enum": [
1712917170
"png",
@@ -17139,7 +17180,7 @@
1713917180
"exhaustiveCompletions": true
1714017181
},
1714117182
"theme": {
17142-
"_internalId": 193474,
17183+
"_internalId": 193523,
1714317184
"type": "anyOf",
1714417185
"anyOf": [
1714517186
{

src/resources/schema/definitions.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,4 +2977,25 @@
29772977
typography:
29782978
ref: brand-typography
29792979
defaults:
2980+
ref: brand-defaults
2981+
2982+
- id: brand-defaults
2983+
object:
2984+
properties:
2985+
bootstrap:
2986+
ref: brand-defaults-bootstrap
2987+
quarto:
29802988
schema: object
2989+
2990+
- id: brand-defaults-bootstrap
2991+
object:
2992+
properties:
2993+
defaults:
2994+
schema:
2995+
object:
2996+
additionalProperties:
2997+
schema:
2998+
anyOf:
2999+
- string
3000+
- boolean
3001+
- number

src/resources/schema/json-schemas.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,6 +3204,9 @@
32043204
"mastodon": {
32053205
"type": "string"
32063206
},
3207+
"bluesky": {
3208+
"type": "string"
3209+
},
32073210
"github": {
32083211
"type": "string"
32093212
},
@@ -3767,11 +3770,34 @@
37673770
"$ref": "#/$defs/BrandTypography"
37683771
},
37693772
"defaults": {
3773+
"$ref": "#/$defs/BrandDefaults"
3774+
}
3775+
}
3776+
}
3777+
},
3778+
"BrandDefaults": {
3779+
"object": {
3780+
"properties": {
3781+
"bootstrap": {
3782+
"$ref": "#/$defs/BrandDefaultsBootstrap"
3783+
},
3784+
"quarto": {
37703785
"type": "object"
37713786
}
37723787
}
37733788
}
37743789
},
3790+
"BrandDefaultsBootstrap": {
3791+
"object": {
3792+
"properties": {
3793+
"defaults": {
3794+
"object": {
3795+
"properties": {}
3796+
}
3797+
}
3798+
}
3799+
}
3800+
},
37753801
"ProjectConfig": {
37763802
"object": {
37773803
"properties": {

0 commit comments

Comments
 (0)