mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 12:07:08 -04:00
refactor: move frontmatter parser into commons package
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4d0a2cb79e
commit
db43e1db3f
26 changed files with 462 additions and 321 deletions
34
commons/src/note-frontmatter/frontmatter.ts
Normal file
34
commons/src/note-frontmatter/frontmatter.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { ISO6391 } from './iso6391.js'
|
||||
import { SlideOptions } from './slide-show-options.js'
|
||||
|
||||
export type Iso6391Language = (typeof ISO6391)[number]
|
||||
|
||||
export type OpenGraph = Record<string, string>
|
||||
|
||||
export enum NoteTextDirection {
|
||||
LTR = 'ltr',
|
||||
RTL = 'rtl'
|
||||
}
|
||||
|
||||
export enum NoteType {
|
||||
DOCUMENT = 'document',
|
||||
SLIDE = 'slide'
|
||||
}
|
||||
export interface NoteFrontmatter {
|
||||
title: string
|
||||
description: string
|
||||
tags: string[]
|
||||
robots: string
|
||||
lang: Iso6391Language
|
||||
dir: NoteTextDirection
|
||||
newlinesAreBreaks: boolean
|
||||
license: string
|
||||
type: NoteType
|
||||
opengraph: OpenGraph
|
||||
slideOptions: SlideOptions
|
||||
}
|
211
commons/src/note-frontmatter/iso6391.ts
Normal file
211
commons/src/note-frontmatter/iso6391.ts
Normal file
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export const ISO6391 = [
|
||||
'aa',
|
||||
'ab',
|
||||
'af',
|
||||
'am',
|
||||
'ar',
|
||||
'ar-ae',
|
||||
'ar-bh',
|
||||
'ar-dz',
|
||||
'ar-eg',
|
||||
'ar-iq',
|
||||
'ar-jo',
|
||||
'ar-kw',
|
||||
'ar-lb',
|
||||
'ar-ly',
|
||||
'ar-ma',
|
||||
'ar-om',
|
||||
'ar-qa',
|
||||
'ar-sa',
|
||||
'ar-sy',
|
||||
'ar-tn',
|
||||
'ar-ye',
|
||||
'as',
|
||||
'ay',
|
||||
'de',
|
||||
'de-at',
|
||||
'de-ch',
|
||||
'de-li',
|
||||
'de-lu',
|
||||
'div',
|
||||
'dz',
|
||||
'el',
|
||||
'en',
|
||||
'en-au',
|
||||
'en-bz',
|
||||
'en-ca',
|
||||
'en-gb',
|
||||
'en-ie',
|
||||
'en-jm',
|
||||
'en-nz',
|
||||
'en-ph',
|
||||
'en-tt',
|
||||
'en-us',
|
||||
'en-za',
|
||||
'en-zw',
|
||||
'eo',
|
||||
'es',
|
||||
'es-ar',
|
||||
'es-bo',
|
||||
'es-cl',
|
||||
'es-co',
|
||||
'es-cr',
|
||||
'es-do',
|
||||
'es-ec',
|
||||
'es-es',
|
||||
'es-gt',
|
||||
'es-hn',
|
||||
'es-mx',
|
||||
'es-ni',
|
||||
'es-pa',
|
||||
'es-pe',
|
||||
'es-pr',
|
||||
'es-py',
|
||||
'es-sv',
|
||||
'es-us',
|
||||
'es-uy',
|
||||
'es-ve',
|
||||
'et',
|
||||
'eu',
|
||||
'fa',
|
||||
'fi',
|
||||
'fj',
|
||||
'fo',
|
||||
'fr',
|
||||
'fr-be',
|
||||
'fr-ca',
|
||||
'fr-ch',
|
||||
'fr-lu',
|
||||
'fr-mc',
|
||||
'fy',
|
||||
'ga',
|
||||
'gd',
|
||||
'gl',
|
||||
'gn',
|
||||
'gu',
|
||||
'ha',
|
||||
'he',
|
||||
'hi',
|
||||
'hr',
|
||||
'hu',
|
||||
'hy',
|
||||
'ia',
|
||||
'id',
|
||||
'ie',
|
||||
'ik',
|
||||
'in',
|
||||
'is',
|
||||
'it',
|
||||
'it-ch',
|
||||
'iw',
|
||||
'ja',
|
||||
'ji',
|
||||
'jw',
|
||||
'ka',
|
||||
'kk',
|
||||
'kl',
|
||||
'km',
|
||||
'kn',
|
||||
'ko',
|
||||
'kok',
|
||||
'ks',
|
||||
'ku',
|
||||
'ky',
|
||||
'kz',
|
||||
'la',
|
||||
'ln',
|
||||
'lo',
|
||||
'ls',
|
||||
'lt',
|
||||
'lv',
|
||||
'mg',
|
||||
'mi',
|
||||
'mk',
|
||||
'ml',
|
||||
'mn',
|
||||
'mo',
|
||||
'mr',
|
||||
'ms',
|
||||
'mt',
|
||||
'my',
|
||||
'na',
|
||||
'nb-no',
|
||||
'ne',
|
||||
'nl',
|
||||
'nl-be',
|
||||
'nn-no',
|
||||
'no',
|
||||
'oc',
|
||||
'om',
|
||||
'or',
|
||||
'pa',
|
||||
'pl',
|
||||
'ps',
|
||||
'pt',
|
||||
'pt-br',
|
||||
'qu',
|
||||
'rm',
|
||||
'rn',
|
||||
'ro',
|
||||
'ro-md',
|
||||
'ru',
|
||||
'ru-md',
|
||||
'rw',
|
||||
'sa',
|
||||
'sb',
|
||||
'sd',
|
||||
'sg',
|
||||
'sh',
|
||||
'si',
|
||||
'sk',
|
||||
'sl',
|
||||
'sm',
|
||||
'sn',
|
||||
'so',
|
||||
'sq',
|
||||
'sr',
|
||||
'ss',
|
||||
'st',
|
||||
'su',
|
||||
'sv',
|
||||
'sv-fi',
|
||||
'sw',
|
||||
'sx',
|
||||
'syr',
|
||||
'ta',
|
||||
'te',
|
||||
'tg',
|
||||
'th',
|
||||
'ti',
|
||||
'tk',
|
||||
'tl',
|
||||
'tn',
|
||||
'to',
|
||||
'tr',
|
||||
'ts',
|
||||
'tt',
|
||||
'tw',
|
||||
'uk',
|
||||
'ur',
|
||||
'us',
|
||||
'uz',
|
||||
'vi',
|
||||
'vo',
|
||||
'wo',
|
||||
'xh',
|
||||
'yi',
|
||||
'yo',
|
||||
'zh',
|
||||
'zh-cn',
|
||||
'zh-hk',
|
||||
'zh-mo',
|
||||
'zh-sg',
|
||||
'zh-tw',
|
||||
'zu'
|
||||
] as const
|
15
commons/src/note-frontmatter/slide-show-options.ts
Normal file
15
commons/src/note-frontmatter/slide-show-options.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type { RevealOptions } from 'reveal.js'
|
||||
|
||||
type WantedRevealOptions =
|
||||
| 'autoSlide'
|
||||
| 'autoSlideStoppable'
|
||||
| 'transition'
|
||||
| 'backgroundTransition'
|
||||
| 'slideNumber'
|
||||
|
||||
export type SlideOptions = Pick<RevealOptions, WantedRevealOptions>
|
Loading…
Add table
Add a link
Reference in a new issue