myst-frontmatter
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -11,2 +11,3 @@ import type { ValidationOptions } from 'simple-validators'; | ||
export declare function fillPageFrontmatter(pageFrontmatter: PageFrontmatter, projectFrontmatter: ProjectFrontmatter, opts: ValidationOptions): PageFrontmatter; | ||
export declare function fillProjectFrontmatter(base: ProjectFrontmatter, filler: ProjectFrontmatter, opts: ValidationOptions, keys?: string[]): ProjectFrontmatter; | ||
//# sourceMappingURL=fillPageFrontmatter.d.ts.map |
@@ -13,30 +13,33 @@ import { fillMissingKeys, incrementOptions, validationWarning } from 'simple-validators'; | ||
export function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) { | ||
return fillProjectFrontmatter(pageFrontmatter, projectFrontmatter, opts, USE_PROJECT_FALLBACK); | ||
} | ||
export function fillProjectFrontmatter(base, filler, opts, keys) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; | ||
const frontmatter = fillMissingKeys(pageFrontmatter, projectFrontmatter, USE_PROJECT_FALLBACK); | ||
if (pageFrontmatter.numbering || projectFrontmatter.numbering) { | ||
frontmatter.numbering = fillNumbering(pageFrontmatter.numbering, projectFrontmatter.numbering); | ||
const frontmatter = fillMissingKeys(base, filler, keys !== null && keys !== void 0 ? keys : Object.keys(filler)); | ||
if (filler.numbering || base.numbering) { | ||
frontmatter.numbering = fillNumbering(base.numbering, filler.numbering); | ||
} | ||
// Combine all math macros defined on page and project | ||
if (projectFrontmatter.math || pageFrontmatter.math) { | ||
frontmatter.math = { ...((_a = projectFrontmatter.math) !== null && _a !== void 0 ? _a : {}), ...((_b = pageFrontmatter.math) !== null && _b !== void 0 ? _b : {}) }; | ||
if (filler.math || base.math) { | ||
frontmatter.math = { ...((_a = filler.math) !== null && _a !== void 0 ? _a : {}), ...((_b = base.math) !== null && _b !== void 0 ? _b : {}) }; | ||
} | ||
// Combine all abbreviation defined on page and project | ||
if (projectFrontmatter.abbreviations || pageFrontmatter.abbreviations) { | ||
if (filler.abbreviations || base.abbreviations) { | ||
frontmatter.abbreviations = { | ||
...((_c = projectFrontmatter.abbreviations) !== null && _c !== void 0 ? _c : {}), | ||
...((_d = pageFrontmatter.abbreviations) !== null && _d !== void 0 ? _d : {}), | ||
...((_c = filler.abbreviations) !== null && _c !== void 0 ? _c : {}), | ||
...((_d = base.abbreviations) !== null && _d !== void 0 ? _d : {}), | ||
}; | ||
} | ||
// Combine all options defined on page and project | ||
if (projectFrontmatter.options || pageFrontmatter.options) { | ||
if (filler.options || base.options) { | ||
frontmatter.options = { | ||
...((_e = projectFrontmatter.options) !== null && _e !== void 0 ? _e : {}), | ||
...((_f = pageFrontmatter.options) !== null && _f !== void 0 ? _f : {}), | ||
...((_e = filler.options) !== null && _e !== void 0 ? _e : {}), | ||
...((_f = base.options) !== null && _f !== void 0 ? _f : {}), | ||
}; | ||
} | ||
// Combine all settings defined on page and project | ||
if (projectFrontmatter.settings || pageFrontmatter.settings) { | ||
if (filler.settings || base.settings) { | ||
frontmatter.settings = { | ||
...((_g = projectFrontmatter.settings) !== null && _g !== void 0 ? _g : {}), | ||
...((_h = pageFrontmatter.settings) !== null && _h !== void 0 ? _h : {}), | ||
...((_g = filler.settings) !== null && _g !== void 0 ? _g : {}), | ||
...((_h = base.settings) !== null && _h !== void 0 ? _h : {}), | ||
}; | ||
@@ -72,6 +75,6 @@ } | ||
const people = [ | ||
...((_o = pageFrontmatter.authors) !== null && _o !== void 0 ? _o : []), | ||
...((_p = projectFrontmatter.authors) !== null && _p !== void 0 ? _p : []), | ||
...((_q = pageFrontmatter.contributors) !== null && _q !== void 0 ? _q : []), | ||
...((_r = projectFrontmatter.contributors) !== null && _r !== void 0 ? _r : []), | ||
...((_o = base.authors) !== null && _o !== void 0 ? _o : []), | ||
...((_p = filler.authors) !== null && _p !== void 0 ? _p : []), | ||
...((_q = base.contributors) !== null && _q !== void 0 ? _q : []), | ||
...((_r = filler.contributors) !== null && _r !== void 0 ? _r : []), | ||
]; | ||
@@ -118,6 +121,3 @@ const peopleLookup = {}; | ||
if (affiliationIds.size) { | ||
const affiliations = [ | ||
...((_w = pageFrontmatter.affiliations) !== null && _w !== void 0 ? _w : []), | ||
...((_x = projectFrontmatter.affiliations) !== null && _x !== void 0 ? _x : []), | ||
]; | ||
const affiliations = [...((_w = base.affiliations) !== null && _w !== void 0 ? _w : []), ...((_x = filler.affiliations) !== null && _x !== void 0 ? _x : [])]; | ||
const affiliationLookup = {}; | ||
@@ -124,0 +124,0 @@ affiliations.forEach((aff) => { |
{ | ||
"name": "myst-frontmatter", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
208076
5306