Skip to content

Commit 21b495f

Browse files
committed
schema for project profile
1 parent e1cddd0 commit 21b495f

File tree

6 files changed

+123
-30
lines changed

6 files changed

+123
-30
lines changed

src/core/lib/yaml-schema/project-config.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,17 @@ export const getProjectConfigSchema = defineCached(
9898
const projectConfigFields = await getProjectConfigFieldsSchema();
9999
const execute = await getFormatExecuteOptionsSchema();
100100
const format = await getFrontMatterFormatSchema();
101+
const profile = refSchema(
102+
"project-profile",
103+
"Specify a default profile and profile groups",
104+
);
101105

102-
const profile = objectS({
103-
additionalProperties: anyOfSchema(
104-
regexSchema(".+"),
105-
refSchema("project-config", "a project configuration schema"),
106-
),
107-
});
108106
const result = allOfS(
109107
objectS({
110108
properties: {
111109
execute,
112110
format,
113-
// profile,
111+
profile,
114112
},
115113
description: "be a Quarto YAML front matter object",
116114
}),

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

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10696,6 +10696,27 @@ var require_yaml_intelligence_resources = __commonJS({
1069610696
pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
1069710697
},
1069810698
description: "Version number according to Semantic Versioning"
10699+
},
10700+
{
10701+
id: "project-profile",
10702+
schema: {
10703+
object: {
10704+
closed: true,
10705+
properties: {
10706+
default: {
10707+
maybeArrayOf: "string",
10708+
description: "Default profile to apply if QUARTO_PROFILE is not defined.\n"
10709+
},
10710+
group: {
10711+
maybeArrayOf: {
10712+
arrayOf: "string"
10713+
},
10714+
description: "Define a profile group for which at least one profile is always active.\n"
10715+
}
10716+
}
10717+
}
10718+
},
10719+
description: "Specify a default profile and profile groups"
1069910720
}
1070010721
],
1070110722
"schema/document-about.yml": [
@@ -17781,6 +17802,9 @@ var require_yaml_intelligence_resources = __commonJS({
1778117802
"Textual content to add to includes",
1778217803
"Name of file with content to add to includes",
1778317804
"Version number according to Semantic Versioning",
17805+
"Specify a default profile and profile groups",
17806+
"Default profile to apply if QUARTO_PROFILE is not defined.",
17807+
"Define a profile group for which at least one profile is always\nactive.",
1778417808
{
1778517809
short: "Unique label for code cell",
1778617810
long: "Unique label for code cell. Used when other code needs to refer to\nthe cell (e.g.&nbsp;for cross references <code>fig-samples</code> or\n<code>tbl-summary</code>)"
@@ -18413,7 +18437,7 @@ var require_yaml_intelligence_resources = __commonJS({
1841318437
long: 'Options for the <a href="https://ctan.org/pkg/geometry">geometry</a>\npackage. For example:'
1841418438
},
1841518439
{
18416-
short: "Options for the hyperref package.",
18440+
short: "Additional non-color options for the hyperref package.",
1841718441
long: 'Options for the <a href="https://ctan.org/pkg/hyperref">hyperref</a>\npackage. For example:'
1841818442
},
1841918443
{
@@ -19335,12 +19359,12 @@ var require_yaml_intelligence_resources = __commonJS({
1933519359
mermaid: "%%"
1933619360
},
1933719361
"handlers/mermaid/schema.yml": {
19338-
_internalId: 128900,
19362+
_internalId: 128940,
1933919363
type: "object",
1934019364
description: "be an object",
1934119365
properties: {
1934219366
"mermaid-format": {
19343-
_internalId: 128899,
19367+
_internalId: 128939,
1934419368
type: "enum",
1934519369
enum: [
1934619370
"png",
@@ -28698,17 +28722,16 @@ var getProjectConfigSchema = defineCached(
2869828722
const projectConfigFields = await getProjectConfigFieldsSchema();
2869928723
const execute = await getFormatExecuteOptionsSchema();
2870028724
const format = await getFrontMatterFormatSchema();
28701-
const profile = objectSchema({
28702-
additionalProperties: anyOfSchema(
28703-
regexSchema(".+"),
28704-
refSchema("project-config", "a project configuration schema")
28705-
)
28706-
});
28725+
const profile = refSchema(
28726+
"project-profile",
28727+
"Specify a default profile and profile groups"
28728+
);
2870728729
const result = allOfSchema(
2870828730
objectSchema({
2870928731
properties: {
2871028732
execute,
28711-
format
28733+
format,
28734+
profile
2871228735
},
2871328736
description: "be a Quarto YAML front matter object"
2871428737
}),

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

Lines changed: 33 additions & 10 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: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3672,6 +3672,27 @@
36723672
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
36733673
},
36743674
"description": "Version number according to Semantic Versioning"
3675+
},
3676+
{
3677+
"id": "project-profile",
3678+
"schema": {
3679+
"object": {
3680+
"closed": true,
3681+
"properties": {
3682+
"default": {
3683+
"maybeArrayOf": "string",
3684+
"description": "Default profile to apply if QUARTO_PROFILE is not defined.\n"
3685+
},
3686+
"group": {
3687+
"maybeArrayOf": {
3688+
"arrayOf": "string"
3689+
},
3690+
"description": "Define a profile group for which at least one profile is always active.\n"
3691+
}
3692+
}
3693+
}
3694+
},
3695+
"description": "Specify a default profile and profile groups"
36753696
}
36763697
],
36773698
"schema/document-about.yml": [
@@ -10757,6 +10778,9 @@
1075710778
"Textual content to add to includes",
1075810779
"Name of file with content to add to includes",
1075910780
"Version number according to Semantic Versioning",
10781+
"Specify a default profile and profile groups",
10782+
"Default profile to apply if QUARTO_PROFILE is not defined.",
10783+
"Define a profile group for which at least one profile is always\nactive.",
1076010784
{
1076110785
"short": "Unique label for code cell",
1076210786
"long": "Unique label for code cell. Used when other code needs to refer to\nthe cell (e.g.&nbsp;for cross references <code>fig-samples</code> or\n<code>tbl-summary</code>)"
@@ -11389,7 +11413,7 @@
1138911413
"long": "Options for the <a href=\"https://ctan.org/pkg/geometry\">geometry</a>\npackage. For example:"
1139011414
},
1139111415
{
11392-
"short": "Options for the hyperref package.",
11416+
"short": "Additional non-color options for the hyperref package.",
1139311417
"long": "Options for the <a href=\"https://ctan.org/pkg/hyperref\">hyperref</a>\npackage. For example:"
1139411418
},
1139511419
{
@@ -12311,12 +12335,12 @@
1231112335
"mermaid": "%%"
1231212336
},
1231312337
"handlers/mermaid/schema.yml": {
12314-
"_internalId": 128900,
12338+
"_internalId": 128940,
1231512339
"type": "object",
1231612340
"description": "be an object",
1231712341
"properties": {
1231812342
"mermaid-format": {
12319-
"_internalId": 128899,
12343+
"_internalId": 128939,
1232012344
"type": "enum",
1232112345
"enum": [
1232212346
"png",

src/resources/schema/definitions.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,3 +1882,19 @@
18821882
# from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
18831883
pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
18841884
description: Version number according to Semantic Versioning
1885+
1886+
- id: project-profile
1887+
schema:
1888+
object:
1889+
closed: true
1890+
properties:
1891+
default:
1892+
maybeArrayOf: string
1893+
description: |
1894+
Default profile to apply if QUARTO_PROFILE is not defined.
1895+
group:
1896+
maybeArrayOf:
1897+
arrayOf: string
1898+
description: |
1899+
Define a profile group for which at least one profile is always active.
1900+
description: Specify a default profile and profile groups

src/resources/types/schema-types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,15 @@ export type SmartInclude = {
10071007
export type Semver =
10081008
string; /* Version number according to Semantic Versioning */
10091009

1010+
export type ProjectProfile = {
1011+
default?: MaybeArrayOf<
1012+
string
1013+
> /* Default profile to apply if QUARTO_PROFILE is not defined. */;
1014+
group?: MaybeArrayOf<
1015+
(string)[]
1016+
>; /* Define a profile group for which at least one profile is always active. */
1017+
};
1018+
10101019
export type ProjectConfig = {
10111020
"execute-dir"?:
10121021
| "file"

0 commit comments

Comments
 (0)