Skip to content

Commit 221dd4c

Browse files
committed
schema: allow array of tbl-cap
1 parent f6e4f29 commit 221dd4c

File tree

4 files changed

+52
-39
lines changed

4 files changed

+52
-39
lines changed

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

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7875,7 +7875,9 @@ var require_yaml_intelligence_resources = __commonJS({
78757875
"schema/cell-table.yml": [
78767876
{
78777877
name: "tbl-cap",
7878-
schema: "string",
7878+
schema: {
7879+
maybeArrayOf: "string"
7880+
},
78797881
description: "Table caption"
78807882
},
78817883
{
@@ -17077,7 +17079,7 @@ var require_yaml_intelligence_resources = __commonJS({
1707717079
"Website description",
1707817080
"The path to the favicon for this website",
1707917081
"Base URL for published website",
17080-
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
17082+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1708117083
"Base URL for website source code repository",
1708217084
"Subdirectory of repository containing website",
1708317085
"Branch of website source code (defaults to <code>main</code>)",
@@ -18570,7 +18572,7 @@ var require_yaml_intelligence_resources = __commonJS({
1857018572
"Description metadata for HTML version of book",
1857118573
"The path to the favicon for this website",
1857218574
"Base URL for published website",
18573-
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
18575+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1857418576
"Base URL for website source code repository",
1857518577
"Subdirectory of repository containing website",
1857618578
"Branch of website source code (defaults to <code>main</code>)",
@@ -18749,8 +18751,8 @@ var require_yaml_intelligence_resources = __commonJS({
1874918751
"Cover image (used in HTML and ePub formats)",
1875018752
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
1875118753
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
18752-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
18753-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
18754+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
18755+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
1875418756
"Custom tools for navbar or sidebar",
1875518757
"internal-schema-hack",
1875618758
"Project configuration.",
@@ -18771,7 +18773,7 @@ var require_yaml_intelligence_resources = __commonJS({
1877118773
"Description metadata for HTML version of book",
1877218774
"The path to the favicon for this website",
1877318775
"Base URL for published website",
18774-
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
18776+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1877518777
"Base URL for website source code repository",
1877618778
"Subdirectory of repository containing website",
1877718779
"Branch of website source code (defaults to <code>main</code>)",
@@ -18950,8 +18952,8 @@ var require_yaml_intelligence_resources = __commonJS({
1895018952
"Cover image (used in HTML and ePub formats)",
1895118953
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
1895218954
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
18953-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
18954-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
18955+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
18956+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
1895518957
"Custom tools for navbar or sidebar",
1895618958
"internal-schema-hack"
1895718959
],
@@ -25818,6 +25820,9 @@ var ValidationContext = class {
2581825820
if (e.schemaPath.indexOf("propertyNames") !== -1) {
2581925821
return 10;
2582025822
}
25823+
if (t[0] === "required") {
25824+
return 0;
25825+
}
2582125826
if (t[0] === "type") {
2582225827
if (t[1] === "null") {
2582325828
return 10;
@@ -26128,9 +26133,9 @@ function validateObject(value, schema2, context) {
2612826133
}
2612926134
return result;
2613026135
}
26131-
function validate(value, schema2, source) {
26136+
function validate(value, schema2, source, pruneErrors = true) {
2613226137
const context = new ValidationContext();
26133-
return context.validate(schema2, source, value);
26138+
return context.validate(schema2, source, value, pruneErrors);
2613426139
}
2613526140

2613626141
// ../yaml-validation/yaml-schema.ts
@@ -26154,8 +26159,8 @@ var YAMLSchema = class {
2615426159
return error;
2615526160
}).filter((error) => error !== null);
2615626161
}
26157-
async validateParse(src, annotation) {
26158-
const validationErrors = validate(annotation, this.schema, src);
26162+
async validateParse(src, annotation, pruneErrors = true) {
26163+
const validationErrors = validate(annotation, this.schema, src, pruneErrors);
2615926164
if (validationErrors.length) {
2616026165
const localizedErrors = this.transformErrors(annotation, validationErrors);
2616126166
return {
@@ -26750,7 +26755,7 @@ var isObject2 = (value) => {
2675026755
const type2 = typeof value;
2675126756
return value !== null && (type2 === "object" || type2 === "function");
2675226757
};
26753-
async function readAndValidateYamlFromMappedString(mappedYaml, schema2) {
26758+
async function readAndValidateYamlFromMappedString(mappedYaml, schema2, pruneErrors = true) {
2675426759
const result = await withValidator(schema2, async (validator) => {
2675526760
const annotation = await readAnnotatedYamlFromMappedString(mappedYaml);
2675626761
if (annotation === null) {
@@ -26759,7 +26764,7 @@ async function readAndValidateYamlFromMappedString(mappedYaml, schema2) {
2675926764
const validateYaml = !isObject2(annotation.result) || annotation.result["validate-yaml"] !== false;
2676026765
const yaml = annotation.result;
2676126766
if (validateYaml) {
26762-
const valResult = await validator.validateParse(mappedYaml, annotation);
26767+
const valResult = await validator.validateParse(mappedYaml, annotation, pruneErrors);
2676326768
return {
2676426769
yaml,
2676526770
yamlValidationErrors: valResult.errors
@@ -27492,7 +27497,7 @@ async function breakQuartoMd(src, validate2 = false) {
2749227497
let codeEndRange;
2749327498
const lineBuffer = [];
2749427499
const flushLineBuffer = async (cell_type, index) => {
27495-
if (lineBuffer.length) {
27500+
if (lineBuffer.length || cell_type === "code") {
2749627501
const mappedChunks = [];
2749727502
for (const line of lineBuffer) {
2749827503
mappedChunks.push(line.range);

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

Lines changed: 20 additions & 15 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: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,9 @@
854854
"schema/cell-table.yml": [
855855
{
856856
"name": "tbl-cap",
857-
"schema": "string",
857+
"schema": {
858+
"maybeArrayOf": "string"
859+
},
858860
"description": "Table caption"
859861
},
860862
{
@@ -10056,7 +10058,7 @@
1005610058
"Website description",
1005710059
"The path to the favicon for this website",
1005810060
"Base URL for published website",
10059-
"Path to site (defaults to ‘/’). Not required if you specify\n<code>site-url</code>.",
10061+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1006010062
"Base URL for website source code repository",
1006110063
"Subdirectory of repository containing website",
1006210064
"Branch of website source code (defaults to <code>main</code>)",
@@ -11549,7 +11551,7 @@
1154911551
"Description metadata for HTML version of book",
1155011552
"The path to the favicon for this website",
1155111553
"Base URL for published website",
11552-
"Path to site (defaults to ‘/’). Not required if you specify\n<code>site-url</code>.",
11554+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1155311555
"Base URL for website source code repository",
1155411556
"Subdirectory of repository containing website",
1155511557
"Branch of website source code (defaults to <code>main</code>)",
@@ -11728,8 +11730,8 @@
1172811730
"Cover image (used in HTML and ePub formats)",
1172911731
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
1173011732
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
11731-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
11732-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
11733+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
11734+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
1173311735
"Custom tools for navbar or sidebar",
1173411736
"internal-schema-hack",
1173511737
"Project configuration.",
@@ -11750,7 +11752,7 @@
1175011752
"Description metadata for HTML version of book",
1175111753
"The path to the favicon for this website",
1175211754
"Base URL for published website",
11753-
"Path to site (defaults to ‘/’). Not required if you specify\n<code>site-url</code>.",
11755+
"Path to site (defaults to <code>/</code>). Not required if you\nspecify <code>site-url</code>.",
1175411756
"Base URL for website source code repository",
1175511757
"Subdirectory of repository containing website",
1175611758
"Branch of website source code (defaults to <code>main</code>)",
@@ -11929,8 +11931,8 @@
1192911931
"Cover image (used in HTML and ePub formats)",
1193011932
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
1193111933
"Sharing buttons to include on navbar or sidebar (one or more of\n<code>twitter</code>, <code>facebook</code>, <code>linkedin</code>)",
11932-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
11933-
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
11934+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
11935+
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and\n<code>docx</code>)",
1193411936
"Custom tools for navbar or sidebar",
1193511937
"internal-schema-hack"
1193611938
],

src/resources/schema/cell-table.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- name: tbl-cap
2-
schema: string
2+
schema:
3+
maybeArrayOf: string
34
description: Table caption
45

56
- name: tbl-subcap

0 commit comments

Comments
 (0)