-
Notifications
You must be signed in to change notification settings - Fork 397
Manage projectcontext objects correctly on preview #13804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,20 +33,23 @@ import { kTextPlain } from "../../core/mime.ts"; | |
| import { normalizePath } from "../../core/path.ts"; | ||
| import { notebookContext } from "../../render/notebook/notebook-context.ts"; | ||
| import { singleFileProjectContext } from "../../project/types/single-file/single-file.ts"; | ||
| import { assert } from "testing/asserts"; | ||
| import { ProjectContext } from "../../project/types.ts"; | ||
|
|
||
| export async function render( | ||
| path: string, | ||
| options: RenderOptions, | ||
| pContext?: ProjectContext, | ||
| ): Promise<RenderResult> { | ||
| // one time initialization of yaml validators | ||
| setInitializer(initYamlIntelligenceResourcesFromFilesystem); | ||
| await initState(); | ||
|
|
||
| const nbContext = notebookContext(); | ||
| const nbContext = pContext?.notebookContext || notebookContext(); | ||
|
|
||
| // determine target context/files | ||
| let context = await projectContext(path, nbContext, options); | ||
| // let context = await projectContext(path, nbContext, options); | ||
| let context = pContext || (await projectContext(path, nbContext, options)) || | ||
| (await singleFileProjectContext(path, nbContext, options)); | ||
|
Comment on lines
+50
to
+52
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the change that makes a test fail. Before we add Now this does not go there, and Is this expected to fix the preview problem that we fallback to singleFileProject here ? |
||
|
|
||
| // Create a synthetic project when --output-dir is used without a project file | ||
| // This creates a temporary .quarto directory to manage the render, which must | ||
|
|
@@ -61,6 +64,7 @@ export async function render( | |
|
|
||
| // set env var if requested | ||
| if (context && options.setProjectDir) { | ||
| // FIXME we can't set environment variables like this with asyncs flying around | ||
| Deno.env.set("QUARTO_PROJECT_DIR", context.dir); | ||
| } | ||
|
|
||
|
|
@@ -98,10 +102,6 @@ export async function render( | |
| // validate that we didn't get any project-only options | ||
| validateDocumentRenderFlags(options.flags); | ||
|
|
||
| assert(!context, "Expected no context here"); | ||
| // NB: singleFileProjectContext is currently not fully-featured | ||
| context = await singleFileProjectContext(path, nbContext, options); | ||
|
|
||
| // otherwise it's just a file render | ||
| const result = await renderFiles( | ||
| [{ path }], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this flag ?
Just to understand. Because we probably need to do the same in
quarto.cmdfor the windows version to keep both scripts in sync.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps with debugging and shouldn't otherwise hurt. It's not important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll add it. Otherwise we don't know why both script are differents.