diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 07:37:14 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 07:37:14 -0400 |
commit | 913f418eadb0b085c805ff1c83b749a0ce620741 (patch) | |
tree | 6d369056d724552ac5191930ae87c05b93ee64fc /src/data/yaml.js | |
parent | db0fd78ca60fc695f87d1f3adf53967bdae2796f (diff) |
data: annotated artwork references
Not used on-site, but this is all coded internally.
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 = { |