/** * Copyright (c) 2022 Amorphous * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { FragmentObject, SceneObject } from '@a-morphous/recital/dist/types/types' import { StageToInkConfig } from '../types' export const convertMetaIntoInkTags = ( token: SceneObject | FragmentObject, config: StageToInkConfig ) => { let tagsString = '' if (!token.meta) { return '' } for (let key in token.meta) { if (key === 'title' && !config?.addStats) { continue // titles are listed as the top-level... } const value = JSON.stringify(token.meta[key]) const splits = value.split('\n') for (let split of splits) { tagsString += `# ${key.toLocaleUpperCase()}: ${split}\n` } } return tagsString }