From 913f418eadb0b085c805ff1c83b749a0ce620741 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 14 Nov 2024 07:37:14 -0400 Subject: data: annotated artwork references Not used on-site, but this is all coded internally. --- src/data/yaml.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/data/yaml.js') 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 = { -- cgit 1.3.0-6-gf8a5