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

parser/metadecoders: Accumulate org keywords into arrays #11741

Merged
merged 1 commit into from Jan 25, 2024

Conversation

augustfengd
Copy link
Contributor

Hey all! What are your thoughts on this change?

The keywords definition from the org syntax specification doesn't say we can't repeat keywords.

This change will also enable terms in org mode to have space.

Currently, repeated keywords are concatenated: #+title: foo\n#+title: bar would render as foo bar. With this change, it just doesn't render anything but hugo is not crashing either.

@jmooring
Copy link
Member

From this project's README:

... create a proposal. Do not submit a pull request until the project lead accepts the proposal.

We first need to decide if we want to do this. This introduces yet another feature (multi-word strings) that is not natively supported by org mode.

@jmooring jmooring closed this Nov 26, 2023
@augustfengd augustfengd deleted the org/keywords-without-brackets branch November 26, 2023 23:13
@augustfengd augustfengd restored the org/keywords-without-brackets branch November 26, 2023 23:17
@augustfengd
Copy link
Contributor Author

Hey @jmooring, I've a created a proposal. Thanks for the advice.

I would just note that multi-word strings are natively supported in org mode, otherwise something as #+title: foo bar baz would not work.

@jmooring jmooring reopened this Dec 24, 2023
} else if k == "tags" || k == "categories" || k == "aliases" {
log.Printf("warn: Please use '#+%s[]:' notation, automatic conversion is deprecated.", k)
frontMatter[k] = strings.Fields(v)
} else if strings.HasSuffix(k, "[]") {
Copy link
Member

Choose a reason for hiding this comment

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

You have a repeated condition here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh my, thanks for catching that. I've just fixed the commit.

@jmooring
Copy link
Member

Test site:

git clone --single-branch -b hugo-github-issue-11743 https://github.com/jmooring/hugo-testing hugo-github-issue-11743
cd hugo-github-issue-11743
hugo server

@augustfengd
Copy link
Contributor Author

I've separated the patch into two commits. Do let me know if I should rebase them into one, though.

@jmooring
Copy link
Member

Please squash the commits, and change the commit message per these guidelines:
https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#git-commit-message-guidelines

For example:

parser/metadecoders: Allow multiword elements in Org mode arrays

Closes #11743

@augustfengd
Copy link
Contributor Author

Amazing, thanks for the hint. I've just squashed the commits.

@jmooring
Copy link
Member

@bep I am in favor of merging this. The only users that will be negatively affected are those who have been ignoring a related warning for the past 4.5 years.

@jmooring jmooring changed the title support repeated keywords in org mode files as arrays parser/metadecoders: Accumulate org keywords into arrays Dec 30, 2023
@bep bep merged commit 46f6187 into gohugoio:master Jan 25, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants