Skip to content

Commit fbcfd8c

Browse files
committed
Add support for global output-location
Fixes #3261
1 parent 909fb79 commit fbcfd8c

File tree

10 files changed

+169
-58
lines changed

10 files changed

+169
-58
lines changed

src/command/render/filters.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
kKeepHidden,
3030
kMergeIncludes,
3131
kOutputDivs,
32+
kOutputLocation,
3233
kPdfEngine,
3334
kQuartoFilters,
3435
kReferenceLocation,
@@ -489,6 +490,12 @@ async function quartoFilterParams(
489490
if (figResponsive) {
490491
params[kFigResponsive] = figResponsive;
491492
}
493+
494+
const outputLocation = format.metadata[kOutputLocation];
495+
if (outputLocation) {
496+
params[kOutputLocation] = outputLocation;
497+
}
498+
492499
const lineNumbers = format.render[kCodeLineNumbers];
493500
if (lineNumbers) {
494501
params[kCodeLineNumbers] = lineNumbers;

src/config/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ export const kCrossrefChaptersAlpha = "chapters-alpha";
514514
export const kCrossrefChapterId = "chapter-id";
515515

516516
export const kFigResponsive = "fig-responsive";
517+
export const kOutputLocation = "output-location";
517518

518519
export const kCapLoc = "cap-location";
519520
export const kFigCapLoc = "fig-cap-location";

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

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8016,17 +8016,7 @@ var require_yaml_intelligence_resources = __commonJS({
80168016
]
80178017
},
80188018
schema: {
8019-
enum: [
8020-
"default",
8021-
"fragment",
8022-
"slide",
8023-
"column",
8024-
"column-fragment"
8025-
]
8026-
},
8027-
description: {
8028-
short: "Location of output relative to the code that generated it (`default`, `fragment`, `slide`, `column`, or `column-location`)",
8029-
long: "Location of output relative to the code that generated it. The possible values are as follows:\n\n- `default`: Normal flow of the slide after the code\n- `fragment`: In a fragment (not visible until you advance)\n- `slide`: On a new slide after the curent one\n- 'column': In an adjacent column \n- `column-fragment`: In an adjacent column (not visible until you advance)\n\nNote that this option is supported only for the `revealjs` format.\n"
8019+
ref: "output-location-schema"
80308020
}
80318021
},
80328022
{
@@ -11102,6 +11092,22 @@ var require_yaml_intelligence_resources = __commonJS({
1110211092
}
1110311093
}
1110411094
}
11095+
},
11096+
{
11097+
id: "output-location-schema",
11098+
schema: {
11099+
enum: [
11100+
"default",
11101+
"fragment",
11102+
"slide",
11103+
"column",
11104+
"column-fragment"
11105+
],
11106+
description: {
11107+
short: "Location of output relative to the code that generated it (`default`, `fragment`, `slide`, `column`, or `column-location`)",
11108+
long: "Location of output relative to the code that generated it. The possible values are as follows:\n\n- `default`: Normal flow of the slide after the code\n- `fragment`: In a fragment (not visible until you advance)\n- `slide`: On a new slide after the curent one\n- 'column': In an adjacent column \n- `column-fragment`: In an adjacent column (not visible until you advance)\n\nNote that this option is supported only for the `revealjs` format.\n"
11109+
}
11110+
}
1110511111
}
1110611112
],
1110711113
"schema/document-about.yml": [
@@ -15671,6 +15677,17 @@ var require_yaml_intelligence_resources = __commonJS({
1567115677
short: "Use a smaller default font for slide content",
1567215678
long: "`true` to use a smaller default font for slide content. This can also\nbe set per-slide by including the `.smaller` class on the slide title.\n"
1567315679
}
15680+
},
15681+
{
15682+
name: "output-location",
15683+
tags: {
15684+
formats: [
15685+
"revealjs"
15686+
]
15687+
},
15688+
schema: {
15689+
ref: "output-location-schema"
15690+
}
1567415691
}
1567515692
],
1567615693
"schema/document-reveal-hidden.yml": [
@@ -19237,6 +19254,10 @@ var require_yaml_intelligence_resources = __commonJS({
1923719254
"Specify a default profile and profile groups",
1923819255
"Default profile to apply if QUARTO_PROFILE is not defined.",
1923919256
"Define a profile group for which at least one profile is always\nactive.",
19257+
{
19258+
short: "Location of output relative to the code that generated it\n(<code>default</code>, <code>fragment</code>, <code>slide</code>,\n<code>column</code>, or <code>column-location</code>)",
19259+
long: "Location of output relative to the code that generated it. The\npossible values are as follows:"
19260+
},
1924019261
{
1924119262
short: "Unique label for code cell",
1924219263
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>)"
@@ -21009,7 +21030,11 @@ var require_yaml_intelligence_resources = __commonJS({
2100921030
long: "Title of the volume of the item or container holding the item.\nAlso use for titles of periodical special issues, special sections,\nand the like."
2101021031
},
2101121032
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
21012-
"internal-schema-hack"
21033+
"internal-schema-hack",
21034+
{
21035+
short: "Location of output relative to the code that generated it\n(<code>default</code>, <code>fragment</code>, <code>slide</code>,\n<code>column</code>, or <code>column-location</code>)",
21036+
long: "Location of output relative to the code that generated it. The\npossible values are as follows:"
21037+
}
2101321038
],
2101421039
"schema/external-schemas.yml": [
2101521040
{
@@ -21234,12 +21259,12 @@ var require_yaml_intelligence_resources = __commonJS({
2123421259
mermaid: "%%"
2123521260
},
2123621261
"handlers/mermaid/schema.yml": {
21237-
_internalId: 151732,
21262+
_internalId: 152009,
2123821263
type: "object",
2123921264
description: "be an object",
2124021265
properties: {
2124121266
"mermaid-format": {
21242-
_internalId: 151724,
21267+
_internalId: 152001,
2124321268
type: "enum",
2124421269
enum: [
2124521270
"png",
@@ -21255,7 +21280,7 @@ var require_yaml_intelligence_resources = __commonJS({
2125521280
exhaustiveCompletions: true
2125621281
},
2125721282
theme: {
21258-
_internalId: 151731,
21283+
_internalId: 152008,
2125921284
type: "anyOf",
2126021285
anyOf: [
2126121286
{

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

Lines changed: 40 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: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -992,17 +992,7 @@
992992
]
993993
},
994994
"schema": {
995-
"enum": [
996-
"default",
997-
"fragment",
998-
"slide",
999-
"column",
1000-
"column-fragment"
1001-
]
1002-
},
1003-
"description": {
1004-
"short": "Location of output relative to the code that generated it (`default`, `fragment`, `slide`, `column`, or `column-location`)",
1005-
"long": "Location of output relative to the code that generated it. The possible values are as follows:\n\n- `default`: Normal flow of the slide after the code\n- `fragment`: In a fragment (not visible until you advance)\n- `slide`: On a new slide after the curent one\n- 'column': In an adjacent column \n- `column-fragment`: In an adjacent column (not visible until you advance)\n\nNote that this option is supported only for the `revealjs` format.\n"
995+
"ref": "output-location-schema"
1006996
}
1007997
},
1008998
{
@@ -4078,6 +4068,22 @@
40784068
}
40794069
}
40804070
}
4071+
},
4072+
{
4073+
"id": "output-location-schema",
4074+
"schema": {
4075+
"enum": [
4076+
"default",
4077+
"fragment",
4078+
"slide",
4079+
"column",
4080+
"column-fragment"
4081+
],
4082+
"description": {
4083+
"short": "Location of output relative to the code that generated it (`default`, `fragment`, `slide`, `column`, or `column-location`)",
4084+
"long": "Location of output relative to the code that generated it. The possible values are as follows:\n\n- `default`: Normal flow of the slide after the code\n- `fragment`: In a fragment (not visible until you advance)\n- `slide`: On a new slide after the curent one\n- 'column': In an adjacent column \n- `column-fragment`: In an adjacent column (not visible until you advance)\n\nNote that this option is supported only for the `revealjs` format.\n"
4085+
}
4086+
}
40814087
}
40824088
],
40834089
"schema/document-about.yml": [
@@ -8647,6 +8653,17 @@
86478653
"short": "Use a smaller default font for slide content",
86488654
"long": "`true` to use a smaller default font for slide content. This can also\nbe set per-slide by including the `.smaller` class on the slide title.\n"
86498655
}
8656+
},
8657+
{
8658+
"name": "output-location",
8659+
"tags": {
8660+
"formats": [
8661+
"revealjs"
8662+
]
8663+
},
8664+
"schema": {
8665+
"ref": "output-location-schema"
8666+
}
86508667
}
86518668
],
86528669
"schema/document-reveal-hidden.yml": [
@@ -12213,6 +12230,10 @@
1221312230
"Specify a default profile and profile groups",
1221412231
"Default profile to apply if QUARTO_PROFILE is not defined.",
1221512232
"Define a profile group for which at least one profile is always\nactive.",
12233+
{
12234+
"short": "Location of output relative to the code that generated it\n(<code>default</code>, <code>fragment</code>, <code>slide</code>,\n<code>column</code>, or <code>column-location</code>)",
12235+
"long": "Location of output relative to the code that generated it. The\npossible values are as follows:"
12236+
},
1221612237
{
1221712238
"short": "Unique label for code cell",
1221812239
"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>)"
@@ -13985,7 +14006,11 @@
1398514006
"long": "Title of the volume of the item or container holding the item.\nAlso use for titles of periodical special issues, special sections,\nand the like."
1398614007
},
1398714008
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
13988-
"internal-schema-hack"
14009+
"internal-schema-hack",
14010+
{
14011+
"short": "Location of output relative to the code that generated it\n(<code>default</code>, <code>fragment</code>, <code>slide</code>,\n<code>column</code>, or <code>column-location</code>)",
14012+
"long": "Location of output relative to the code that generated it. The\npossible values are as follows:"
14013+
}
1398914014
],
1399014015
"schema/external-schemas.yml": [
1399114016
{
@@ -14210,12 +14235,12 @@
1421014235
"mermaid": "%%"
1421114236
},
1421214237
"handlers/mermaid/schema.yml": {
14213-
"_internalId": 151732,
14238+
"_internalId": 152009,
1421414239
"type": "object",
1421514240
"description": "be an object",
1421614241
"properties": {
1421714242
"mermaid-format": {
14218-
"_internalId": 151724,
14243+
"_internalId": 152001,
1421914244
"type": "enum",
1422014245
"enum": [
1422114246
"png",
@@ -14231,7 +14256,7 @@
1423114256
"exhaustiveCompletions": true
1423214257
},
1423314258
"theme": {
14234-
"_internalId": 151731,
14259+
"_internalId": 152008,
1423514260
"type": "anyOf",
1423614261
"anyOf": [
1423714262
{

src/resources/filters/quarto-pre/output-location.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ local function collectCellOutputLocation(el)
66
el.attr.classes:includes("cell") then
77
local outputLoc = el.attr.attributes["output-location"]
88
el.attr.attributes["output-location"] = nil
9+
if outputLoc == nil then
10+
outputLoc = param('output-location')
11+
end
912
return outputLoc
1013
else
1114
return nil

src/resources/schema/cell-textoutput.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,7 @@
5555
tags:
5656
formats: [revealjs]
5757
schema:
58-
enum: [default, fragment, slide, column, column-fragment]
59-
description:
60-
short: Location of output relative to the code that generated it (`default`, `fragment`, `slide`, `column`, or `column-location`)
61-
long: |
62-
Location of output relative to the code that generated it. The possible values are as follows:
63-
64-
- `default`: Normal flow of the slide after the code
65-
- `fragment`: In a fragment (not visible until you advance)
66-
- `slide`: On a new slide after the curent one
67-
- 'column': In an adjacent column
68-
- `column-fragment`: In an adjacent column (not visible until you advance)
69-
70-
Note that this option is supported only for the `revealjs` format.
58+
ref: output-location-schema
7159

7260
- name: message
7361
tags:

0 commit comments

Comments
 (0)