myst-frontmatter
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -0,1 +1,2 @@ | ||
import type { TOC } from 'myst-toc'; | ||
export declare enum ExportFormats { | ||
@@ -22,7 +23,11 @@ pdf = "pdf", | ||
zip?: boolean; | ||
toc?: string; | ||
toc?: TOC; | ||
articles?: ExportArticle[]; | ||
top_level?: 'parts' | 'chapters' | 'sections'; | ||
/** sub_articles are only for jats xml export */ | ||
sub_articles?: string[]; | ||
/** MECA: to, from later */ | ||
/** tocFile is not set by user; it will be set instead of `toc` when user provides a string for `toc`*/ | ||
tocFile?: string; | ||
} & Record<string, any>; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { defined, incrementOptions, validateBoolean, validateEnum, validateList, validateNumber, validateObjectKeys, validateString, validationError, } from 'simple-validators'; | ||
import { defined, incrementOptions, validateBoolean, validateChoice, validateEnum, validateList, validateNumber, validateObjectKeys, validateString, validationError, } from 'simple-validators'; | ||
import { PAGE_FRONTMATTER_KEYS } from '../page/types.js'; | ||
@@ -6,2 +6,3 @@ import { PROJECT_FRONTMATTER_KEYS } from '../project/types.js'; | ||
import { ExportFormats } from './types.js'; | ||
import { validateTOC } from 'myst-toc'; | ||
const EXPORT_KEY_OBJECT = { | ||
@@ -18,2 +19,3 @@ required: [], | ||
'articles', | ||
'top_level', | ||
'sub_articles', | ||
@@ -216,2 +218,8 @@ ], | ||
} | ||
if (defined(value.top_level)) { | ||
validExport.top_level = validateChoice(value.top_level || 'sections', { | ||
...incrementOptions('top_level', opts), | ||
choices: ['parts', 'chapters', 'sections'], | ||
}); | ||
} | ||
if (defined(value.sub_articles)) { | ||
@@ -231,7 +239,12 @@ if (validExport.format !== ExportFormats.xml) { | ||
if (validExport.articles || validExport.sub_articles) { | ||
validationError('export cannot define both toc file and articles/sub_articles; ignoring toc', tocOpts); | ||
validationError('export cannot define both toc and articles/sub_articles; ignoring toc', tocOpts); | ||
validExport.toc = undefined; | ||
} | ||
else if (typeof value.toc === 'string') { | ||
// Support legacy behavior of providing a jupyterbook toc file as export.toc | ||
validExport.tocFile = value.toc; | ||
validExport.toc = undefined; | ||
} | ||
else { | ||
validExport.toc = validateString(value.toc, tocOpts); | ||
validExport.toc = validateTOC(value.toc, tocOpts); | ||
} | ||
@@ -238,0 +251,0 @@ } |
@@ -39,7 +39,2 @@ import { defined, incrementOptions, validateList, validateObjectKeys, validateString, validationError, validateBoolean, } from 'simple-validators'; | ||
} | ||
if (defined(value.tags)) { | ||
output.tags = validateList(value.tags, incrementOptions('tags', opts), (file, index) => { | ||
return validateString(file, incrementOptions(`tags.${index}`, opts)); | ||
}); | ||
} | ||
const partsOptions = incrementOptions('parts', opts); | ||
@@ -46,0 +41,0 @@ let parts; |
@@ -42,3 +42,4 @@ import type { Biblio } from '../biblio/types.js'; | ||
thebe?: ExpandedThebeFrontmatter; | ||
toc?: any[]; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -31,2 +31,3 @@ import { SITE_FRONTMATTER_KEYS } from '../site/types.js'; | ||
'thebe', | ||
'toc', | ||
]; |
import { defined, filterKeys, incrementOptions, validateBoolean, validateDate, validateList, validateObject, validateObjectKeys, validateString, validateUrl, } from 'simple-validators'; | ||
import { validateTOC } from 'myst-toc'; | ||
import { validateBiblio } from '../biblio/validators.js'; | ||
@@ -135,2 +136,5 @@ import { validateDownloadsList } from '../downloads/validators.js'; | ||
} | ||
if (defined(value.toc)) { | ||
output.toc = validateTOC(value.toc, incrementOptions('toc', opts)); | ||
} | ||
if (defined(value.requirements)) { | ||
@@ -137,0 +141,0 @@ output.requirements = validateList(value.requirements, incrementOptions('requirements', opts), (req, index) => { |
@@ -44,2 +44,3 @@ import type { Affiliation } from '../affiliations/types.js'; | ||
authors?: Contributor[]; | ||
tags?: string[]; | ||
/** | ||
@@ -46,0 +47,0 @@ * Reviewers and editors are author/contributor ids. |
@@ -10,2 +10,3 @@ export const SITE_FRONTMATTER_KEYS = [ | ||
'bannerOptimized', | ||
'tags', | ||
'authors', | ||
@@ -12,0 +13,0 @@ 'reviewers', |
@@ -36,2 +36,7 @@ import { defined, incrementOptions, validateList, validateObject, validateString, validationError, } from 'simple-validators'; | ||
} | ||
if (defined(value.tags)) { | ||
output.tags = validateList(value.tags, incrementOptions('tags', opts), (file, index) => { | ||
return validateString(file, incrementOptions(`tags.${index}`, opts)); | ||
}); | ||
} | ||
const stash = {}; | ||
@@ -38,0 +43,0 @@ if (defined(value.affiliations)) { |
{ | ||
"name": "myst-frontmatter", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"sideEffects": false, | ||
@@ -39,3 +39,4 @@ "license": "MIT", | ||
"simple-validators": "^1.0.5", | ||
"spdx-correct": "^3.2.0" | ||
"spdx-correct": "^3.2.0", | ||
"myst-toc": "^0.1.1" | ||
}, | ||
@@ -42,0 +43,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213632
5442
6
+ Addedmyst-toc@^0.1.1
+ Addedmyst-toc@0.1.2(transitive)