From 89b4170cd67d0914bb895592716f62662186dbb6 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sun, 10 Jul 2022 19:55:19 -0500 Subject: [PATCH] also join complement with perfect and modal --- package.json | 2 +- src/components/blocks/Block.tsx | 15 ++++++++++----- src/lib/phrase-building/blocks-utils.ts | 2 +- src/lib/phrase-building/render-vp.ts | 2 ++ src/types.ts | 2 ++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2f31bb5..2f5975a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "3.3.5", + "version": "3.3.6", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/components/blocks/Block.tsx b/src/components/blocks/Block.tsx index e8794b6..2fb3252 100644 --- a/src/components/blocks/Block.tsx +++ b/src/components/blocks/Block.tsx @@ -103,10 +103,10 @@ function VerbSBlock({ opts, v, script }: { {"long" in v.ps &&
{length}
} <> - {v.type === "verb" && v.complement && - - } - {getLength(v.ps, length)[0][script]} + {(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complement && + + } + {getLength(v.ps, length)[0][script]}
{v.type === "perfectParticipleBlock" ? "Past Partic." : "Verb"}
@@ -133,7 +133,12 @@ function ModalVerbBlock({ opts, v, script }: { return
{"long" in v.ps &&
{length}
} - {getLength(v.ps, length)[0][script]} + <> + {v.complement && + + } + {getLength(v.ps, length)[0][script]} +
Verb
Modal diff --git a/src/lib/phrase-building/blocks-utils.ts b/src/lib/phrase-building/blocks-utils.ts index 4557147..5e6e298 100644 --- a/src/lib/phrase-building/blocks-utils.ts +++ b/src/lib/phrase-building/blocks-utils.ts @@ -118,7 +118,7 @@ export function getComplementFromBlocks(blocks: T.Block[][]): T.Rendered b.block.type === "verb" && b.block)?.block as T.VerbRenderedBlock | undefined; + const verb = getVerbFromBlocks(blocks); if (verb?.block.complement) { return verb.block.complement; } diff --git a/src/lib/phrase-building/render-vp.ts b/src/lib/phrase-building/render-vp.ts index 63eb0c1..c7b3a00 100644 --- a/src/lib/phrase-building/render-vp.ts +++ b/src/lib/phrase-building/render-vp.ts @@ -472,6 +472,7 @@ function splitUpIfModal(v: T.VerbRenderedBlock): [T.VerbRenderedBlock] | [T.Moda type: "modalVerbBlock", ps: vrb, verb: v, + complement: v.block.complement, }, { type: "modalVerbKedulPart", @@ -490,6 +491,7 @@ function getPerfectStuff(v: T.SingleOrLengthOpts, vrb: T.VerbRende ps: p, person: vrb.block.person, verb: vrb, + complement: vrb.block.complement, }, { type: "perfectEquativeBlock", diff --git a/src/types.ts b/src/types.ts index 3db9dbe..1d3b803 100644 --- a/src/types.ts +++ b/src/types.ts @@ -904,6 +904,7 @@ export type PerfectParticipleBlock = { ps: SingleOrLengthOpts, verb: VerbRenderedBlock, person: Person, + complement: undefined | Rendered | Rendered, }; export type PerfectEquativeBlock = { type: "perfectEquativeBlock", @@ -914,6 +915,7 @@ export type ModalVerbBlock = { type: "modalVerbBlock", ps: SingleOrLengthOpts, verb: VerbRenderedBlock, + complement: undefined | Rendered | Rendered, }; export type ModalVerbKedulPart = { type: "modalVerbKedulPart",