Skip to content

Commit 1c38216

Browse files
authored
Merge pull request #11607 from quarto-dev/bugfix/issue-11580
Allow non-strings as `categories` fields
2 parents e20d78d + 8f2ed6d commit 1c38216

File tree

13 files changed

+100
-3
lines changed

13 files changed

+100
-3
lines changed

news/changelog-1.7.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ All changes included in 1.7:
22

33
## Regression fixes
44

5-
- ([#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.
65
- ([#11509](https://github.com/quarto-dev/quarto-cli/issues/11509)): Fix link-decoration regression in HTML formats.
6+
- ([#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.
7+
- ([#11580](https://github.com/quarto-dev/quarto-cli/issues/11580)): Fix regression with documents containing `categories` fields that are not strings.

src/project/types/website/website.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import { projectDraftMode } from "./website-utils.ts";
8989
import { kFieldCategories } from "./listing/website-listing-shared.ts";
9090
import { pandocNativeStr } from "../../../core/pandoc/codegen.ts";
9191
import { asArray } from "../../../core/array.ts";
92+
import { InternalError } from "../../../core/lib/error.ts";
9293

9394
export const kSiteTemplateDefault = "default";
9495
export const kSiteTemplateBlog = "blog";
@@ -207,8 +208,12 @@ export const websiteProjectType: ProjectType = {
207208
extras.metadataOverride[kFieldCategories] = asArray(
208209
format.metadata[kFieldCategories],
209210
).map(
210-
(category) =>
211-
pandocNativeStr(category as string).mappedString().value,
211+
(category) => {
212+
const strCategory: string = typeof category === "string"
213+
? category
214+
: category.toString();
215+
return pandocNativeStr(strCategory).mappedString().value;
216+
},
212217
);
213218
}
214219

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.quarto/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "issue-11580"
6+
navbar:
7+
right:
8+
- about.qmd
9+
- icon: github
10+
href: https://github.com/
11+
- icon: twitter
12+
href: https://twitter.com
13+
format:
14+
html:
15+
theme:
16+
- cosmo
17+
- brand
18+
css: styles.css
19+
20+
21+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "About"
3+
image: profile.jpg
4+
about:
5+
template: jolla
6+
links:
7+
- icon: twitter
8+
text: Twitter
9+
href: https://twitter.com
10+
- icon: linkedin
11+
text: LinkedIn
12+
href: https://linkedin.com
13+
- icon: github
14+
text: Github
15+
href: https://github.com
16+
17+
---
18+
19+
About this blog
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "issue-11580"
3+
listing:
4+
contents: posts
5+
sort: "date desc"
6+
type: default
7+
categories: true
8+
sort-ui: false
9+
filter-ui: false
10+
page-layout: full
11+
title-block-banner: true
12+
_quarto:
13+
render-project: true
14+
---
15+
16+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# options specified here will apply to all posts in this folder
2+
3+
# freeze computational output
4+
# (see https://quarto.org/docs/projects/code-execution.html#freeze)
5+
freeze: true
6+
7+
# Enable banner style title blocks
8+
title-block-banner: true
40.8 KB
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Post With Code"
3+
author: "Harlow Malloc"
4+
date: "2024-12-03"
5+
categories:
6+
- news
7+
- code
8+
- 3
9+
- analysis
10+
image: "image.jpg"
11+
---
12+
13+
This is a post with executable code.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Welcome To My Blog"
3+
author: "Tristan O'Malley"
4+
date: "2024-11-30"
5+
categories: [news]
6+
---
7+
8+
This is the first post in a Quarto blog. Welcome!
9+
10+
![](thumbnail.jpg)
11+
12+
Since this post doesn't specify an explicit `image`, the first image in the post will be used in the listing page of posts.

0 commit comments

Comments
 (0)