diff options
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r-- | src/data/yaml.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js index 3f79aa65..725f4f3a 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -569,6 +569,31 @@ export function parseContributionPresets(list) { }); } +export function parseReferencedArtworks(entries) { + return parseArrayEntries(entries, item => { + if (typeof item === 'object' && item['References']) + return { + reference: item['References'], + annotation: item['Annotation'] ?? null, + }; + + if (typeof item !== 'string') return item; + + const match = item.match(extractAccentRegex); + if (!match) { + return { + reference: item, + annotation: null, + } + } + + return { + reference: match.groups.main, + annotation: match.groups.accent, + }; + }); +} + // documentModes: Symbols indicating sets of behavior for loading and processing // data files. export const documentModes = { |