Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/quarto-check-info
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid authored Dec 3, 2024
2 parents b4e0c5a + 238afdb commit ebe0838
Show file tree
Hide file tree
Showing 21 changed files with 113 additions and 48 deletions.
5 changes: 3 additions & 2 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ All changes included in 1.7:

## Regression fixes

- ([#11532](https://github.com/quarto-dev/quarto-cli/issues/11532)): Fix regression for [#660](https://github.com/quarto-dev/quarto-cli/issues/660), which causes files to have incorrect permissions when Quarto is installed in a location not writable by the current user.
- ([#11509](https://github.com/quarto-dev/quarto-cli/issues/11509)): Fix link-decoration regression in HTML formats.
- ([#11532](https://github.com/quarto-dev/quarto-cli/issues/11532)): Fix regression for [#660](https://github.com/quarto-dev/quarto-cli/issues/660), which causes files to have incorrect permissions when Quarto is installed in a location not writable by the current user.
- ([#11580](https://github.com/quarto-dev/quarto-cli/issues/11580)): Fix regression with documents containing `categories` fields that are not strings.

## `quarto check`

- ([#11608](https://github.com/quarto-dev/quarto-cli/pull/11608)): Do not issue error message when calling `quarto check info`.
- ([#11608](https://github.com/quarto-dev/quarto-cli/pull/11608)): Do not issue error message when calling `quarto check info`.
2 changes: 1 addition & 1 deletion package/src/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function download(src: string, dest: string): Promise<void> {

const file = await Deno.create(dest);
await writeAll(file, contents);
Deno.close(file.rid);
file.close();
}

export async function unzip(
Expand Down
2 changes: 1 addition & 1 deletion src/core/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export function writeFileToStdout(file: string) {
const df = Deno.openSync(file, { read: true });
const contents = readAllSync(df);
writeAllSync(Deno.stdout, contents);
Deno.close(df.rid);
df.close();
}

export function clearLine() {
Expand Down
33 changes: 0 additions & 33 deletions src/core/performance/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,4 @@ export function reportPeformanceMetrics() {
console.log("Performance metrics");
console.log("Quarto:");
console.log(JSON.stringify(quartoPerformanceMetrics(), null, 2));
console.log();
// denoMetrics is some kind of fancy object that doesn't respond
// to a bunch of the normal methods. So we have to do this
// the JSON-round-trip way.
console.log("Deno:");
const denoMetrics = JSON.parse(JSON.stringify(Deno.metrics() as any));
denoMetrics.ops = Object.fromEntries(
Object.entries(denoMetrics.ops).map(
([key, opMetrics]: any) => {
for (const key of Object.keys(opMetrics)) {
if (opMetrics[key] === 0) {
delete opMetrics[key];
}
}
return [key, opMetrics];
},
).filter(([_key, opMetrics]: any) => Object.keys(opMetrics).length > 0)
.map(([key, opMetrics]: any) => {
if (
(opMetrics.opsDispatched === opMetrics.opsDispatchedSync &&
opMetrics.opsDispatched === opMetrics.opsCompleted &&
opMetrics.opsDispatched === opMetrics.opsCompletedSync) ||
(opMetrics.opsDispatched === opMetrics.opsDispatchedAsync &&
opMetrics.opsDispatched === opMetrics.opsCompleted &&
opMetrics.opsDispatched === opMetrics.opsCompletedAsync)
) {
return [key, opMetrics.opsDispatched];
} else {
return [key, opMetrics];
}
}),
);
console.log(JSON.stringify(denoMetrics, null, 2));
}
2 changes: 1 addition & 1 deletion src/core/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function jupyterHubServicePrefix() {
}

export function isInteractiveTerminal() {
return Deno.isatty(Deno.stderr.rid);
return Deno.stderr.isTerminal();
}

export function isInteractiveSession() {
Expand Down
5 changes: 3 additions & 2 deletions src/core/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { MuxAsyncIterator, pooledMap } from "async";
import { iterateReader } from "io/iterate-reader";
import { type Closer, type Reader } from "io/types";
import { debug, info } from "../deno_ral/log.ts";
import { onCleanup } from "./cleanup.ts";
import { ProcessResult } from "./process-types.ts";
Expand Down Expand Up @@ -104,7 +105,7 @@ export async function execProcess(

// Add streams to the multiplexer
const addStream = (
stream: (Deno.Reader & Deno.Closer) | null,
stream: (Reader & Closer) | null,
filter?: (output: string) => string,
) => {
if (stream !== null) {
Expand All @@ -131,7 +132,7 @@ export async function execProcess(
}

// Close the streams
const closeStream = (stream: (Deno.Reader & Deno.Closer) | null) => {
const closeStream = (stream: (Reader & Closer) | null) => {
if (stream) {
stream.close();
}
Expand Down
8 changes: 4 additions & 4 deletions src/project/types/website/listing/website-listing-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(preamble));
await feedFile.write(textEncoder.encode(preamble));

for (const feedItem of feedItems) {
const item = renderEjs(
Expand All @@ -527,7 +527,7 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(item));
await feedFile.write(textEncoder.encode(item));
}

// Render the postamble
Expand All @@ -538,9 +538,9 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(postamble));
await feedFile.write(textEncoder.encode(postamble));
} finally {
Deno.close(feedFile.rid);
feedFile.close();
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/project/types/website/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { projectDraftMode } from "./website-utils.ts";
import { kFieldCategories } from "./listing/website-listing-shared.ts";
import { pandocNativeStr } from "../../../core/pandoc/codegen.ts";
import { asArray } from "../../../core/array.ts";
import { InternalError } from "../../../core/lib/error.ts";

export const kSiteTemplateDefault = "default";
export const kSiteTemplateBlog = "blog";
Expand Down Expand Up @@ -207,8 +208,12 @@ export const websiteProjectType: ProjectType = {
extras.metadataOverride[kFieldCategories] = asArray(
format.metadata[kFieldCategories],
).map(
(category) =>
pandocNativeStr(category as string).mappedString().value,
(category) => {
const strCategory: string = typeof category === "string"
? category
: category.toString();
return pandocNativeStr(strCategory).mappedString().value;
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/publish/common/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function stageDocumentPublish(title: string, publishFiles: PublishFiles) {
const publishDir = globalTempContext().createDir();

// copy all files to it
const stagedFiles = window.structuredClone(publishFiles) as PublishFiles;
const stagedFiles = globalThis.structuredClone(publishFiles) as PublishFiles;
stagedFiles.baseDir = publishDir;
for (const file of publishFiles.files) {
const src = join(publishFiles.baseDir, file);
Expand Down
1 change: 1 addition & 0 deletions tests/docs/smoke-all/2024/12/03/issue-11580/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
21 changes: 21 additions & 0 deletions tests/docs/smoke-all/2024/12/03/issue-11580/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
project:
type: website

website:
title: "issue-11580"
navbar:
right:
- about.qmd
- icon: github
href: https://github.com/
- icon: twitter
href: https://twitter.com
format:
html:
theme:
- cosmo
- brand
css: styles.css



19 changes: 19 additions & 0 deletions tests/docs/smoke-all/2024/12/03/issue-11580/about.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "About"
image: profile.jpg
about:
template: jolla
links:
- icon: twitter
text: Twitter
href: https://twitter.com
- icon: linkedin
text: LinkedIn
href: https://linkedin.com
- icon: github
text: Github
href: https://github.com

---

About this blog
16 changes: 16 additions & 0 deletions tests/docs/smoke-all/2024/12/03/issue-11580/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "issue-11580"
listing:
contents: posts
sort: "date desc"
type: default
categories: true
sort-ui: false
filter-ui: false
page-layout: full
title-block-banner: true
_quarto:
render-project: true
---


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# options specified here will apply to all posts in this folder

# freeze computational output
# (see https://quarto.org/docs/projects/code-execution.html#freeze)
freeze: true

# Enable banner style title blocks
title-block-banner: true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Post With Code"
author: "Harlow Malloc"
date: "2024-12-03"
categories:
- news
- code
- 3
- analysis
image: "image.jpg"
---

This is a post with executable code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Welcome To My Blog"
author: "Tristan O'Malley"
date: "2024-11-30"
categories: [news]
---

This is the first post in a Quarto blog. Welcome!

![](thumbnail.jpg)

Since this post doesn't specify an explicit `image`, the first image in the post will be used in the listing page of posts.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/docs/smoke-all/2024/12/03/issue-11580/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* css styles */
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.1
1.7.2

0 comments on commit ebe0838

Please sign in to comment.