diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-14 20:59:17 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-14 21:35:13 -0300 |
commit | 7342b35d0da518fa5559dadc3239fd574a105432 (patch) | |
tree | a17ec409c03b6ab1a01c2f4cc2ec8ef2f8f85d4b /src/data/yaml.js | |
parent | 6d811c36d2b9795ad58fd0bf11f6033d93863fed (diff) |
data: CommentaryEntry
Fully integrated, all in one commit! Wow!
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r-- | src/data/yaml.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js index 50317238..e6b3fa71 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -11,6 +11,7 @@ import {colors, ENABLE_COLOR, logInfo, logWarn} from '#cli'; import {sortByName} from '#sort'; import Thing from '#thing'; import thingConstructors from '#things'; +import {matchCommentaryEntries} from '#wiki-data'; import { aggregateThrows, @@ -824,6 +825,55 @@ export function parseArtwork({ return transform; } +export function parseCommentary(sourceText, {subdoc, CommentaryEntry}) { + const map = matchEntry => ({ + 'Artists': + matchEntry.artistReferences + .split(',') + .map(ref => ref.trim()), + + 'Artist Text': + matchEntry.artistDisplayText, + + 'Annotation': + matchEntry.annotation, + + 'Date': + matchEntry.date, + + 'Second Date': + matchEntry.secondDate, + + 'Date Kind': + matchEntry.dateKind, + + 'Access Date': + matchEntry.accessDate, + + 'Access Kind': + matchEntry.accessKind, + + 'Body': + matchEntry.body, + }); + + const documents = + matchCommentaryEntries(sourceText) + .map(matchEntry => + withEntries( + map(matchEntry), + entries => entries + .filter(([key, value]) => + value !== undefined && + value !== null))); + + const subdocs = + documents.map(document => + subdoc(CommentaryEntry, document, {bindInto: 'thing'})); + + return subdocs; +} + // documentModes: Symbols indicating sets of behavior for loading and processing // data files. export const documentModes = { @@ -1499,6 +1549,10 @@ export function linkWikiDataArrays(wikiData, {bindFind, bindReverse}) { ['artworkData', ['artworkData']], + ['commentaryData', [/* find */]], + + ['creditingSourceData', [/* find */]], + ['flashData', [ 'wikiInfo', ]], |