feat(publish): Frontmatter unterstützt a-tag-liste
This commit is contained in:
parent
66ff33e34a
commit
4986eae592
|
|
@ -32,6 +32,7 @@ export interface Frontmatter {
|
||||||
lang?: string
|
lang?: string
|
||||||
authors?: Author[]
|
authors?: Author[]
|
||||||
images?: ImageEntry[]
|
images?: ImageEntry[]
|
||||||
|
a?: string[]
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,24 @@ Deno.test('parseFrontmatter: erhält Leerzeichen in String-Werten', () => {
|
||||||
const { fm } = parseFrontmatter(md)
|
const { fm } = parseFrontmatter(md)
|
||||||
assertEquals(fm.title, 'Hello World')
|
assertEquals(fm.title, 'Hello World')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Deno.test('parseFrontmatter: liest a-tag-liste aus frontmatter', () => {
|
||||||
|
const md = [
|
||||||
|
'---',
|
||||||
|
'title: T',
|
||||||
|
'slug: s',
|
||||||
|
'date: 2024-01-01',
|
||||||
|
'a:',
|
||||||
|
' - "30023:abc:other-slug"',
|
||||||
|
'---',
|
||||||
|
'body',
|
||||||
|
].join('\n')
|
||||||
|
const { fm } = parseFrontmatter(md)
|
||||||
|
assertEquals(fm.a, ['30023:abc:other-slug'])
|
||||||
|
})
|
||||||
|
|
||||||
|
Deno.test('parseFrontmatter: a fehlt → undefined', () => {
|
||||||
|
const md = '---\ntitle: T\nslug: s\ndate: 2024-01-01\n---\nbody'
|
||||||
|
const { fm } = parseFrontmatter(md)
|
||||||
|
assertEquals(fm.a, undefined)
|
||||||
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue