-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π©βπ¬ Add more frontmatter fields for different venue types (#1503)
- Loading branch information
Showing
21 changed files
with
392 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'myst-frontmatter': patch | ||
--- | ||
|
||
Add more frontmatter fields for different venue types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'myst-frontmatter': patch | ||
'myst-to-jats': patch | ||
'myst-cli': patch | ||
--- | ||
|
||
Deprecate biblio in favor of complete volume/issue objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { describe, expect, it, beforeEach, vi } from 'vitest'; | ||
import memfs from 'memfs'; | ||
import { Session } from '../session'; | ||
import { projectFromPath } from './fromPath'; | ||
import { pagesFromSphinxTOC, projectFromSphinxTOC } from './fromTOC'; | ||
import { tocFromProject } from './toTOC'; | ||
import { handleDeprecatedFields } from './config'; | ||
import { VFile } from 'vfile'; | ||
|
||
describe('config file coercion', () => { | ||
it('site frontmatter is lifted', async () => { | ||
const vfile = new VFile(); | ||
const conf = { site: { frontmatter: { a: 1 }, other: true } }; | ||
handleDeprecatedFields(conf, '', vfile); | ||
expect(conf).toEqual({ site: { a: 1, other: true } }); | ||
expect(vfile.messages.length).toBe(1); | ||
}); | ||
it('project frontmatter is lifted', async () => { | ||
const vfile = new VFile(); | ||
const conf = { project: { frontmatter: { a: 1 }, other: true } }; | ||
handleDeprecatedFields(conf, '', vfile); | ||
expect(conf).toEqual({ project: { a: 1, other: true } }); | ||
expect(vfile.messages.length).toBe(1); | ||
}); | ||
it('site logoText is renamed logo_text', async () => { | ||
const vfile = new VFile(); | ||
const conf = { site: { logoText: 'my logo', other: true } }; | ||
handleDeprecatedFields(conf, '', vfile); | ||
expect(conf).toEqual({ site: { logo_text: 'my logo', other: true } }); | ||
expect(vfile.messages.length).toBe(1); | ||
}); | ||
it('project biblio is lifted', async () => { | ||
const vfile = new VFile(); | ||
const conf = { | ||
project: { | ||
biblio: { volume: 12, issue: 'spring', first_page: 1, last_page: 100 }, | ||
other: true, | ||
}, | ||
}; | ||
handleDeprecatedFields(conf, '', vfile); | ||
expect(conf).toEqual({ | ||
project: { | ||
volume: 12, | ||
issue: 'spring', | ||
first_page: 1, | ||
last_page: 100, | ||
other: true, | ||
}, | ||
}); | ||
expect(vfile.messages.length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,48 @@ | ||
title: Biblio | ||
cases: | ||
- title: empty object returns self | ||
- title: empty object is removed | ||
raw: | ||
biblio: {} | ||
normalized: | ||
biblio: {} | ||
volume: {} | ||
issue: {} | ||
normalized: {} | ||
- title: extra keys removed | ||
raw: | ||
biblio: | ||
volume: | ||
extra: '' | ||
normalized: | ||
biblio: {} | ||
normalized: {} | ||
warnings: 1 | ||
- title: full object returns self | ||
raw: | ||
biblio: | ||
volume: test | ||
issue: example | ||
first_page: 1 | ||
last_page: 2 | ||
volume: | ||
number: 12 | ||
doi: 10.0000/abc123 | ||
title: test proceedings | ||
subject: test subject | ||
issue: | ||
name: spring | ||
doi: 10.0000/abc456 | ||
title: test proceedings | ||
subject: test subject | ||
normalized: | ||
biblio: | ||
volume: test | ||
issue: example | ||
first_page: 1 | ||
last_page: 2 | ||
volume: | ||
number: 12 | ||
doi: 10.0000/abc123 | ||
title: test proceedings | ||
subject: test subject | ||
issue: | ||
number: spring | ||
doi: 10.0000/abc456 | ||
title: test proceedings | ||
subject: test subject | ||
- title: number input coerces to number field | ||
raw: | ||
volume: 12 | ||
normalized: | ||
volume: | ||
number: 12 | ||
- title: string input coerces to number field | ||
raw: | ||
volume: twelve | ||
normalized: | ||
volume: | ||
number: twelve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
export type Biblio = { | ||
// https://docs.openalex.org/about-the-data/work#biblio | ||
volume?: string | number; // sometimes you'll get fun values like "Spring" and "Inside cover." | ||
issue?: string | number; | ||
doi?: string; // Issue DOI | ||
first_page?: string | number; | ||
last_page?: string | number; | ||
export type PublicationMeta = { | ||
number?: string | number; // sometimes you'll get fun values like "Spring" and "Inside cover." | ||
doi?: string; | ||
title?: string; | ||
subject?: string; | ||
}; |
Oops, something went wrong.