myst-frontmatter
Advanced tools
Comparing version 1.5.2 to 1.5.3
export type Biblio = { | ||
volume?: string | number; | ||
issue?: string | number; | ||
doi?: string; | ||
first_page?: string | number; | ||
@@ -5,0 +6,0 @@ last_page?: string | number; |
import { defined, incrementOptions, validateObjectKeys } from 'simple-validators'; | ||
import { validateStringOrNumber } from '../utils/validators.js'; | ||
const BIBLIO_KEYS = ['volume', 'issue', 'first_page', 'last_page']; | ||
import { validateDoi, validateStringOrNumber } from '../utils/validators.js'; | ||
const BIBLIO_KEYS = ['volume', 'issue', 'doi', 'first_page', 'last_page']; | ||
/** | ||
@@ -20,2 +20,5 @@ * Validate Biblio object | ||
} | ||
if (defined(value.doi)) { | ||
output.doi = validateDoi(value.doi, incrementOptions('doi', opts)); | ||
} | ||
if (defined(value.first_page)) { | ||
@@ -22,0 +25,0 @@ output.first_page = validateStringOrNumber(value.first_page, incrementOptions('first_page', opts)); |
@@ -151,3 +151,3 @@ import { fillMissingKeys, incrementOptions, validationWarning } from 'simple-validators'; | ||
export function fillProjectFrontmatter(base, filler, opts, keys, trimUnused) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1; | ||
const frontmatter = fillSiteFrontmatter(base, filler, opts, keys !== null && keys !== void 0 ? keys : Object.keys(filler), trimUnused); | ||
@@ -175,6 +175,12 @@ if (filler.numbering || base.numbering) { | ||
} | ||
if (filler.biblio || base.biblio) { | ||
frontmatter.biblio = { | ||
...((_g = filler.biblio) !== null && _g !== void 0 ? _g : {}), | ||
...((_h = base.biblio) !== null && _h !== void 0 ? _h : {}), | ||
}; | ||
} | ||
if (!trimUnused) { | ||
if (filler.bibliography || base.bibliography) { | ||
frontmatter.bibliography = [ | ||
...new Set([...((_g = filler.bibliography) !== null && _g !== void 0 ? _g : []), ...((_h = base.bibliography) !== null && _h !== void 0 ? _h : [])]), | ||
...new Set([...((_j = filler.bibliography) !== null && _j !== void 0 ? _j : []), ...((_k = base.bibliography) !== null && _k !== void 0 ? _k : [])]), | ||
]; | ||
@@ -184,3 +190,3 @@ } | ||
frontmatter.requirements = [ | ||
...new Set([...((_j = filler.requirements) !== null && _j !== void 0 ? _j : []), ...((_k = base.requirements) !== null && _k !== void 0 ? _k : [])]), | ||
...new Set([...((_l = filler.requirements) !== null && _l !== void 0 ? _l : []), ...((_m = base.requirements) !== null && _m !== void 0 ? _m : [])]), | ||
]; | ||
@@ -190,3 +196,3 @@ } | ||
frontmatter.resources = [ | ||
...new Set([...((_l = filler.resources) !== null && _l !== void 0 ? _l : []), ...((_m = base.resources) !== null && _m !== void 0 ? _m : [])]), | ||
...new Set([...((_o = filler.resources) !== null && _o !== void 0 ? _o : []), ...((_p = base.resources) !== null && _p !== void 0 ? _p : [])]), | ||
]; | ||
@@ -196,4 +202,4 @@ } | ||
frontmatter.exports = []; | ||
const ids = (_p = (_o = base.exports) === null || _o === void 0 ? void 0 : _o.map(({ id }) => id)) !== null && _p !== void 0 ? _p : []; | ||
(_q = filler.exports) === null || _q === void 0 ? void 0 : _q.forEach((exp) => { | ||
const ids = (_r = (_q = base.exports) === null || _q === void 0 ? void 0 : _q.map(({ id }) => id)) !== null && _r !== void 0 ? _r : []; | ||
(_s = filler.exports) === null || _s === void 0 ? void 0 : _s.forEach((exp) => { | ||
var _a; | ||
@@ -204,9 +210,9 @@ if (!exp.id || !ids.includes(exp.id)) { | ||
}); | ||
(_r = frontmatter.exports) === null || _r === void 0 ? void 0 : _r.push(...((_s = base.exports) !== null && _s !== void 0 ? _s : [])); | ||
(_t = frontmatter.exports) === null || _t === void 0 ? void 0 : _t.push(...((_u = base.exports) !== null && _u !== void 0 ? _u : [])); | ||
} | ||
if (filler.downloads || base.downloads) { | ||
frontmatter.downloads = []; | ||
const ids = (_u = (_t = base.downloads) === null || _t === void 0 ? void 0 : _t.map(({ id }) => id).filter(Boolean)) !== null && _u !== void 0 ? _u : []; | ||
const urls = (_w = (_v = base.downloads) === null || _v === void 0 ? void 0 : _v.map(({ url }) => url).filter(Boolean)) !== null && _w !== void 0 ? _w : []; | ||
(_x = filler.downloads) === null || _x === void 0 ? void 0 : _x.forEach((download) => { | ||
const ids = (_w = (_v = base.downloads) === null || _v === void 0 ? void 0 : _v.map(({ id }) => id).filter(Boolean)) !== null && _w !== void 0 ? _w : []; | ||
const urls = (_y = (_x = base.downloads) === null || _x === void 0 ? void 0 : _x.map(({ url }) => url).filter(Boolean)) !== null && _y !== void 0 ? _y : []; | ||
(_z = filler.downloads) === null || _z === void 0 ? void 0 : _z.forEach((download) => { | ||
var _a, _b; | ||
@@ -220,3 +226,3 @@ if (download.id && !ids.includes(download.id)) { | ||
}); | ||
(_y = frontmatter.downloads) === null || _y === void 0 ? void 0 : _y.push(...((_z = base.downloads) !== null && _z !== void 0 ? _z : [])); | ||
(_0 = frontmatter.downloads) === null || _0 === void 0 ? void 0 : _0.push(...((_1 = base.downloads) !== null && _1 !== void 0 ? _1 : [])); | ||
} | ||
@@ -223,0 +229,0 @@ } |
export type Venue = { | ||
title?: string; | ||
short_title?: string; | ||
url?: string; | ||
doi?: string; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
import { defined, incrementOptions, validateObjectKeys, validateString, validateUrl, } from 'simple-validators'; | ||
import { validateDoi } from '../utils/validators.js'; | ||
/** | ||
@@ -17,3 +18,3 @@ * Validate Venue object against the schema | ||
} | ||
const value = validateObjectKeys(input, { optional: ['title', 'url'] }, opts); | ||
const value = validateObjectKeys(input, { optional: ['title', 'short_title', 'url', 'doi'] }, opts); | ||
if (value === undefined) | ||
@@ -25,6 +26,12 @@ return undefined; | ||
} | ||
if (defined(value.short_title)) { | ||
output.short_title = validateString(value.short_title, incrementOptions('short_title', opts)); | ||
} | ||
if (defined(value.url)) { | ||
output.url = validateUrl(value.url, incrementOptions('url', opts)); | ||
} | ||
if (defined(value.doi)) { | ||
output.doi = validateDoi(value.doi, incrementOptions('doi', opts)); | ||
} | ||
return output; | ||
} |
{ | ||
"name": "myst-frontmatter", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
221386
5586