From 77f0686e87d1f866ed3e90e2ae7e0b828e633995 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 13 Feb 2025 16:14:02 +0100 Subject: [PATCH] schema - add docx to description of book.output-file description --- src/resources/editor/tools/vs-code.mjs | 43 +++++++++++++------ src/resources/editor/tools/yaml/web-worker.js | 43 +++++++++++++------ .../yaml/yaml-intelligence-resources.json | 4 +- .../formats/html/esbuild-analysis-cache.json | 6 +-- src/resources/schema/definitions.yml | 2 +- src/resources/types/schema-types.ts | 2 +- 6 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs index 4e9ee07760e..0a87f9fad20 100644 --- a/src/resources/editor/tools/vs-code.mjs +++ b/src/resources/editor/tools/vs-code.mjs @@ -10105,7 +10105,7 @@ var require_yaml_intelligence_resources = __commonJS({ }, "output-file": { path: { - description: "Base name for single-file output (e.g. PDF, ePub)" + description: "Base name for single-file output (e.g. PDF, ePub, docx)" } }, "cover-image": { @@ -21651,7 +21651,7 @@ var require_yaml_intelligence_resources = __commonJS({ "Short/abbreviated form of container-title;", "A minor contributor to the item; typically cited using \u201Cwith\u201D before\nthe name when listed in a bibliography.", "Curator of an exhibit or collection (e.g. in a museum).", - "Physical (e.g. size) or temporal (e.g.\uFFFD\uFFFDrunning time) dimensions of\nthe item.", + "Physical (e.g. size) or temporal (e.g. running time) dimensions of\nthe item.", "Director (e.g. of a film).", "Minor subdivision of a court with a jurisdiction for a\nlegal item", "(Container) edition holding the item (e.g. \u201C3\u201D when citing a chapter\nin the third edition of a book).", @@ -24817,8 +24817,8 @@ function mappedIndexToLineCol(eitherText) { }; } function mappedLines(str2, keepNewLines = false) { - const lines3 = rangedLines(str2.value, keepNewLines); - return lines3.map((v) => mappedString(str2, [v.range])); + const lines2 = rangedLines(str2.value, keepNewLines); + return lines2.map((v) => mappedString(str2, [v.range])); } // parsing.ts @@ -30795,6 +30795,27 @@ function createLocalizedError(obj) { }; } +// ../is-circular.ts +var isCircular = (obj) => { + const objectSet = /* @__PURE__ */ new WeakSet(); + const detect = (obj2) => { + if (obj2 && typeof obj2 === "object") { + if (objectSet.has(obj2)) { + return true; + } + objectSet.add(obj2); + for (const key in obj2) { + if (Object.hasOwn(obj2, key) && detect(obj2[key])) { + return true; + } + } + objectSet.delete(obj2); + } + return false; + }; + return detect(obj); +}; + // annotated-yaml.ts function postProcessAnnotation(parse) { if (parse.components.length === 1 && parse.start === parse.components[0].start && parse.end === parse.components[0].end) { @@ -30945,16 +30966,10 @@ function buildJsYamlAnnotation(mappedYaml) { `Expected a single result, got ${results.length} instead` ); } - try { - JSON.stringify(results[0]); - } catch (e) { - if (e.message.match("invalid string length")) { - } else if (e.message.match(/circular structure/)) { - throw new InternalError( - `Circular structure detected in parsed yaml: ${e.message}` - ); - } else { - } + if (isCircular(results[0])) { + throw new InternalError( + `Circular structure detected in yaml` + ); } return postProcessAnnotation(results[0]); } diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js index 4d3273d8d1a..e1f362dc059 100644 --- a/src/resources/editor/tools/yaml/web-worker.js +++ b/src/resources/editor/tools/yaml/web-worker.js @@ -10106,7 +10106,7 @@ try { }, "output-file": { path: { - description: "Base name for single-file output (e.g. PDF, ePub)" + description: "Base name for single-file output (e.g. PDF, ePub, docx)" } }, "cover-image": { @@ -21652,7 +21652,7 @@ try { "Short/abbreviated form of container-title;", "A minor contributor to the item; typically cited using \u201Cwith\u201D before\nthe name when listed in a bibliography.", "Curator of an exhibit or collection (e.g. in a museum).", - "Physical (e.g. size) or temporal (e.g.\uFFFD\uFFFDrunning time) dimensions of\nthe item.", + "Physical (e.g. size) or temporal (e.g. running time) dimensions of\nthe item.", "Director (e.g. of a film).", "Minor subdivision of a court with a jurisdiction for a\nlegal item", "(Container) edition holding the item (e.g. \u201C3\u201D when citing a chapter\nin the third edition of a book).", @@ -24831,8 +24831,8 @@ ${heading}`; }; } function mappedLines(str2, keepNewLines = false) { - const lines3 = rangedLines(str2.value, keepNewLines); - return lines3.map((v) => mappedString(str2, [v.range])); + const lines2 = rangedLines(str2.value, keepNewLines); + return lines2.map((v) => mappedString(str2, [v.range])); } // parsing.ts @@ -30809,6 +30809,27 @@ ${reindented} }; } + // ../is-circular.ts + var isCircular = (obj) => { + const objectSet = /* @__PURE__ */ new WeakSet(); + const detect = (obj2) => { + if (obj2 && typeof obj2 === "object") { + if (objectSet.has(obj2)) { + return true; + } + objectSet.add(obj2); + for (const key in obj2) { + if (Object.hasOwn(obj2, key) && detect(obj2[key])) { + return true; + } + } + objectSet.delete(obj2); + } + return false; + }; + return detect(obj); + }; + // annotated-yaml.ts function postProcessAnnotation(parse) { if (parse.components.length === 1 && parse.start === parse.components[0].start && parse.end === parse.components[0].end) { @@ -30959,16 +30980,10 @@ ${tidyverseInfo( `Expected a single result, got ${results.length} instead` ); } - try { - JSON.stringify(results[0]); - } catch (e) { - if (e.message.match("invalid string length")) { - } else if (e.message.match(/circular structure/)) { - throw new InternalError( - `Circular structure detected in parsed yaml: ${e.message}` - ); - } else { - } + if (isCircular(results[0])) { + throw new InternalError( + `Circular structure detected in yaml` + ); } return postProcessAnnotation(results[0]); } diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json index b37443e99fe..8b239d60aea 100644 --- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json +++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json @@ -3077,7 +3077,7 @@ }, "output-file": { "path": { - "description": "Base name for single-file output (e.g. PDF, ePub)" + "description": "Base name for single-file output (e.g. PDF, ePub, docx)" } }, "cover-image": { @@ -14623,7 +14623,7 @@ "Short/abbreviated form of container-title;", "A minor contributor to the item; typically cited using “with” before\nthe name when listed in a bibliography.", "Curator of an exhibit or collection (e.g. in a museum).", - "Physical (e.g. size) or temporal (e.g.��running time) dimensions of\nthe item.", + "Physical (e.g. size) or temporal (e.g. running time) dimensions of\nthe item.", "Director (e.g. of a film).", "Minor subdivision of a court with a jurisdiction for a\nlegal item", "(Container) edition holding the item (e.g. “3” when citing a chapter\nin the third edition of a book).", diff --git a/src/resources/formats/html/esbuild-analysis-cache.json b/src/resources/formats/html/esbuild-analysis-cache.json index 61165dbc321..110a06d005f 100644 --- a/src/resources/formats/html/esbuild-analysis-cache.json +++ b/src/resources/formats/html/esbuild-analysis-cache.json @@ -2,7 +2,7 @@ "quarto.js": { "inputs": { "quarto.js": { - "bytes": 26327, + "bytes": 26396, "imports": [], "format": "esm" } @@ -20,10 +20,10 @@ "entryPoint": "quarto.js", "inputs": { "quarto.js": { - "bytesInOutput": 21890 + "bytesInOutput": 21946 } }, - "bytes": 21890 + "bytes": 21946 } } } diff --git a/src/resources/schema/definitions.yml b/src/resources/schema/definitions.yml index 17c1698629b..69615106c34 100644 --- a/src/resources/schema/definitions.yml +++ b/src/resources/schema/definitions.yml @@ -1203,7 +1203,7 @@ description: "Book references file" output-file: path: - description: "Base name for single-file output (e.g. PDF, ePub)" + description: "Base name for single-file output (e.g. PDF, ePub, docx)" cover-image: path: description: "Cover image (used in HTML and ePub formats)" diff --git a/src/resources/types/schema-types.ts b/src/resources/types/schema-types.ts index 62ff99d293e..c755cbb615d 100644 --- a/src/resources/types/schema-types.ts +++ b/src/resources/types/schema-types.ts @@ -609,7 +609,7 @@ The user’s cookie preferences will automatically control Google Analytics (if export type BookSchema = { "date-format"?: string /* Format string for dates in the book */; "output-file"?: - string /* Base name for single-file output (e.g. PDF, ePub) */; + string /* Base name for single-file output (e.g. PDF, ePub, docx) */; "cover-image"?: string /* Cover image (used in HTML and ePub formats) */; "cover-image-alt"?: string /* Alternative text for cover image (used in HTML format) */;