Skip to content

Commit

Permalink
👩‍⚖️ Add copyright to frontmatter (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch authored Mar 27, 2024
1 parent ebe6581 commit 6f0183d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-days-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-frontmatter': patch
---

Add copyright to frontmatter
3 changes: 3 additions & 0 deletions docs/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ The following table lists the available frontmatter fields, a brief description
* - `license`
- a license object or a string
- page can override project
* - `copyright`
- a string
- page can override project
* - `funding`
- a funding object
- page can override project
Expand Down
1 change: 1 addition & 0 deletions packages/myst-frontmatter/src/page/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const USE_PROJECT_FALLBACK = [
'numbering',
'keywords',
'funding',
'copyright',
'affiliations',
];

Expand Down
7 changes: 7 additions & 0 deletions packages/myst-frontmatter/src/project/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cases:
- requirements.txt
resources:
- my-script.sh
copyright: Authors et al.
normalized:
id: my/project
title: frontmatter
Expand Down Expand Up @@ -109,6 +110,7 @@ cases:
- requirements.txt
resources:
- my-script.sh
copyright: Authors et al.
- title: boolean numbering is valid
raw:
numbering: 'false'
Expand Down Expand Up @@ -174,3 +176,8 @@ cases:
what: ok
warnings: 1
normalized: {}
- title: invalid copyright errors
raw:
copyright: {}
normalized: {}
errors: 1
1 change: 1 addition & 0 deletions packages/myst-frontmatter/src/site/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type SiteFrontmatter = {
github?: string;
keywords?: string[];
funding?: Funding[];
copyright?: string;
contributors?: Contributor[];
options?: Record<string, any>;
};
4 changes: 4 additions & 0 deletions packages/myst-frontmatter/src/site/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const SITE_FRONTMATTER_KEYS = [
'keywords',
'affiliations',
'funding',
'copyright',
'options',
];

Expand Down Expand Up @@ -159,6 +160,9 @@ export function validateSiteFrontmatterKeys(value: Record<string, any>, opts: Va
},
);
}
if (defined(value.copyright)) {
output.copyright = validateString(value.copyright, incrementOptions('copyright', opts));
}
if (defined(value.options)) {
const optionsOptions = incrementOptions('options', opts);
const options = validateObject(value.options, optionsOptions);
Expand Down

0 comments on commit 6f0183d

Please sign in to comment.