From 3e579167d0b8c52aa31b1136aaa22aa64f11d12b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 27 Nov 2025 15:56:40 -0400 Subject: data: Content: chop almost everything --- .../things/content/withAnnotationParts.js | 103 --------------------- 1 file changed, 103 deletions(-) delete mode 100644 src/data/composite/things/content/withAnnotationParts.js (limited to 'src/data/composite/things/content/withAnnotationParts.js') diff --git a/src/data/composite/things/content/withAnnotationParts.js b/src/data/composite/things/content/withAnnotationParts.js deleted file mode 100644 index 15eb74a5..00000000 --- a/src/data/composite/things/content/withAnnotationParts.js +++ /dev/null @@ -1,103 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; -import {empty, transposeArrays} from '#sugar'; -import {is} from '#validators'; - -import {raiseOutputWithoutDependency} from '#composite/control-flow'; -import {withPropertyFromList} from '#composite/data'; -import {splitContentNodesAround, withContentNodes} from '#composite/wiki-data'; - -export default templateCompositeFrom({ - annotation: `withAnnotationParts`, - - inputs: { - mode: input({ - validate: is('strings', 'nodes'), - }), - }, - - outputs: ['#annotationParts'], - - steps: () => [ - raiseOutputWithoutDependency({ - dependency: '_annotation', - output: input.value({'#annotationParts': []}), - }), - - withContentNodes({ - from: '_annotation', - }), - - splitContentNodesAround({ - nodes: '#contentNodes', - around: input.value(/, */g), - }), - - { - dependencies: ['#contentNodeLists'], - compute: (continuation, { - ['#contentNodeLists']: nodeLists, - }) => continuation({ - ['#contentNodeLists']: - nodeLists.filter(list => !empty(list)), - }), - }, - - { - dependencies: ['#contentNodeLists', input('mode')], - compute: (continuation, { - ['#contentNodeLists']: nodeLists, - [input('mode')]: mode, - }) => - (mode === 'nodes' - ? continuation.raiseOutput({'#annotationParts': nodeLists}) - : continuation()), - }, - - { - dependencies: ['#contentNodeLists'], - - compute: (continuation, { - ['#contentNodeLists']: nodeLists, - }) => continuation({ - ['#firstNodes']: - nodeLists.map(list => list.at(0)), - - ['#lastNodes']: - nodeLists.map(list => list.at(-1)), - }), - }, - - withPropertyFromList({ - list: '#firstNodes', - property: input.value('i'), - }).outputs({ - '#firstNodes.i': '#startIndices', - }), - - withPropertyFromList({ - list: '#lastNodes', - property: input.value('iEnd'), - }).outputs({ - '#lastNodes.iEnd': '#endIndices', - }), - - { - dependencies: [ - 'annotation', - '#startIndices', - '#endIndices', - ], - - compute: (continuation, { - ['annotation']: annotation, - ['#startIndices']: startIndices, - ['#endIndices']: endIndices, - }) => continuation({ - ['#annotationParts']: - transposeArrays([startIndices, endIndices]) - .map(([start, end]) => - annotation.slice(start, end)), - }), - }, - ], -}); -- cgit 1.3.0-6-gf8a5