Skip to content

Commit 6a8cfcd

Browse files
committed
Merge branch 'main' of github.com:quarto-dev/quarto-cli into main
2 parents 277d1df + 4186c22 commit 6a8cfcd

File tree

3 files changed

+7
-45
lines changed

3 files changed

+7
-45
lines changed

src/command/serve/cmd.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Command } from "cliffy/command/mod.ts";
99

1010
import * as colors from "fmt/colors.ts";
1111
import { error } from "log/mod.ts";
12+
import { initYamlIntelligenceResourcesFromFilesystem } from "../../core/schema/utils.ts";
1213
import { projectContext } from "../../project/project-context.ts";
1314

1415
import { serve } from "./serve.ts";
@@ -42,6 +43,7 @@ export const serveCommand = new Command()
4243
)
4344
// deno-lint-ignore no-explicit-any
4445
.action(async (options: any, input?: string) => {
46+
await initYamlIntelligenceResourcesFromFilesystem();
4547
if (!input) {
4648
error(
4749
"No input passed to serve.\n" +

src/core/handlers/include.ts

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ import {
1616
} from "../lib/mapped-text.ts";
1717

1818
import { dirname, join, normalize, relative } from "path/mod.ts";
19-
import { encodeMetadata } from "../encode-metadata.ts";
2019
import { rangedLines } from "../lib/ranged-text.ts";
2120
import {
22-
getShortcodeNamedParams,
2321
getShortcodeUnnamedParams,
2422
isBlockShortcode,
2523
} from "../lib/parse-shortcode.ts";
@@ -41,36 +39,10 @@ const includeHandler: LanguageHandler = {
4139
const sourceDir = dirname(source);
4240
const retrievedFiles: string[] = [source];
4341
const retrievedDirectories: string[] = [sourceDir];
44-
const fixups: (boolean | undefined)[] = [];
4542

4643
const textFragments: EitherString[] = [];
4744

48-
const needsFixup = () => {
49-
for (let i = fixups.length - 1; i >= 0; --i) {
50-
if (fixups[i] !== undefined) {
51-
return fixups[i];
52-
}
53-
}
54-
return true;
55-
};
56-
57-
const addFixup = (filename: string) => {
58-
if (fixups.length > 0 && needsFixup()) {
59-
let includeDir = relative(sourceDir, dirname(filename));
60-
if (includeDir === "") {
61-
includeDir = ".";
62-
}
63-
textFragments.push(encodeMetadata({
64-
include_directory: includeDir,
65-
}));
66-
} else {
67-
textFragments.push(encodeMetadata({
68-
clear_include_directory: true,
69-
}));
70-
}
71-
};
72-
73-
const retrieveInclude = (filename: string, fixup: boolean | undefined) => {
45+
const retrieveInclude = (filename: string) => {
7446
const norm = relative(
7547
join(...retrievedDirectories),
7648
normalize(filename),
@@ -96,8 +68,6 @@ const includeHandler: LanguageHandler = {
9668

9769
retrievedFiles.push(filename);
9870
retrievedDirectories.push(dirname(norm));
99-
fixups.push(fixup);
100-
addFixup(filename);
10171

10272
let rangeStart = 0;
10373
for (const { substring, range } of rangedLines(includeSrc.value)) {
@@ -108,18 +78,13 @@ const includeHandler: LanguageHandler = {
10878
);
10979
rangeStart = range.end;
11080
const params = getShortcodeUnnamedParams(m);
111-
const options = getShortcodeNamedParams(m);
11281
if (params.length === 0) {
11382
throw new Error("Include directive needs file parameter");
11483
}
11584
const file = params[0];
116-
const fixup = options.fixup === undefined
117-
? undefined
118-
: (options.fixup.toLocaleLowerCase() !== "false");
11985

12086
retrieveInclude(
12187
join(...[...retrievedDirectories, file]),
122-
fixup,
12388
);
12489
}
12590
}
@@ -135,22 +100,15 @@ const includeHandler: LanguageHandler = {
135100

136101
retrievedFiles.pop();
137102
retrievedDirectories.pop();
138-
fixups.pop();
139-
addFixup(filename);
140103
};
141104

142105
const params = getShortcodeUnnamedParams(directive);
143-
const options = getShortcodeNamedParams(directive);
144106
if (params.length === 0) {
145107
throw new Error("Include directive needs filename as a parameter");
146108
}
147109
const includeName = join(sourceDir, params[0]);
148110

149-
const fixup = options.fixup === undefined
150-
? undefined
151-
: (options.fixup.toLocaleLowerCase() !== "false");
152-
153-
retrieveInclude(includeName, fixup);
111+
retrieveInclude(includeName);
154112

155113
return Promise.resolve(mappedConcat(textFragments));
156114
},

tests/smoke/directives/include-fixups.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*
66
*/
77

8+
/* Disable test for temporarily removed feature.
9+
810
import { ensureHtmlSelectorSatisfies } from "../../verify.ts";
911
1012
import { testRender } from "../render/render.ts";
@@ -35,4 +37,4 @@ testRender(test1.input, "html", false, [
3537
"../link.qmd",
3638
]);
3739
}),
38-
]);
40+
]);*/

0 commit comments

Comments
 (0)