diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-14 20:59:17 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-16 14:29:30 -0300 |
commit | 3453dc831989829f996a2ef3cefa408b94ca70d6 (patch) | |
tree | 06a1e5a71559d47bf937a6a755b5859148195db5 /src/data/yaml.js | |
parent | 5219733b44256f0cdc393e2e2597306545a45eea (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 af1d5740..67922df2 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', ]], |