Skip to content
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

Allow non-strings as categories fields #11607

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ 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.
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;
},
Comment on lines +211 to +216
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now understand what was the issue !

Thanks for having DM-ed me about this so that I learn better about this.

Thanks.

);
}

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 */
Loading