diff --git a/package-lock.json b/package-lock.json index 36a122d..f0a0154 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "7.0.3", + "version": "7.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "7.0.3", + "version": "7.0.4", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 2063128..a0f52fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "7.0.3", + "version": "7.0.4", "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/package-lock.json b/src/components/package-lock.json index a1dd7e2..bcb1db3 100644 --- a/src/components/package-lock.json +++ b/src/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lingdocs/ps-react", - "version": "7.0.3", + "version": "7.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lingdocs/ps-react", - "version": "7.0.3", + "version": "7.0.4", "license": "MIT", "dependencies": { "@formkit/auto-animate": "^1.0.0-beta.3", diff --git a/src/components/package.json b/src/components/package.json index d36868a..5f07188 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "7.0.3", + "version": "7.0.4", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/components/src/Examples.tsx b/src/components/src/Examples.tsx index 3e8d6bc..158e26e 100644 --- a/src/components/src/Examples.tsx +++ b/src/components/src/Examples.tsx @@ -12,48 +12,66 @@ import * as T from "../../types"; type PsStringWSub = T.PsString & { sub?: any }; -function EnglishContent({ children }: { children: (string | JSX.Element)[] | (string | JSX.Element) }) { - if (Array.isArray(children)) { - return <> - {children.map((x) => {x})} - - } - return
- {children} -
; -} - -function Examples(props: ({ - ex: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[], -} | { - children: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[], -}) & { - opts: T.TextOptions, - lineHeight?: 0 | 1 | 2 | 3 | 4, +function EnglishContent({ + children, +}: { + children: (string | JSX.Element)[] | (string | JSX.Element); }) { - const examples = "children" in props ? props.children : props.ex; - const Example = ({ children: text }: { children: PsStringWSub }) => ( -
-
- {text} -
-
- {text} -
- {text.e && - {text.e} - } - {text.sub &&
- {text.sub} -
} -
+ if (Array.isArray(children)) { + return ( + <> + {children.map((x) => ( + {x} + ))} + ); - return Array.isArray(examples) ? -
- {examples.map((example, i) => {example as PsStringWSub})} -
- : - {examples as PsStringWSub}; + } + return ( +
+ {children} +
+ ); } -export default Examples; \ No newline at end of file +function Examples( + props: ( + | { + ex: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[]; + } + | { + children: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[]; + } + ) & { + opts: T.TextOptions; + lineHeight?: 0 | 1 | 2 | 3 | 4; + } +) { + const examples = "children" in props ? props.children : props.ex; + const Example = ({ children: text }: { children: PsStringWSub }) => ( +
+
+ {text} +
+
+ {text} +
+ {text.e && {text.e}} + {text.sub &&
{text.sub}
} +
+ ); + return Array.isArray(examples) ? ( +
+ {examples.map((example, i) => ( + {example as PsStringWSub} + ))} +
+ ) : ( + {examples as PsStringWSub} + ); +} + +export default Examples; diff --git a/src/components/src/Pashto.tsx b/src/components/src/Pashto.tsx index 1d2a297..86b8268 100644 --- a/src/components/src/Pashto.tsx +++ b/src/components/src/Pashto.tsx @@ -6,42 +6,37 @@ * */ -import { - convertSpelling, -} from "../../lib/src/convert-spelling"; -import { - phoneticsToDiacritics -} from "../../lib/src/phonetics-to-diacritics"; +import { convertSpelling } from "../../lib/src/convert-spelling"; +import { phoneticsToDiacritics } from "../../lib/src/phonetics-to-diacritics"; import { psJSXMap } from "./jsx-map"; import * as T from "../../types"; -const Pashto = ({ opts, children: text }: { - opts: T.TextOptions, - children: T.PsString | T.PsJSX, +const Pashto = ({ + opts, + children: text, +}: { + opts: T.TextOptions; + children: T.PsString | T.PsJSX; }) => { - function convertText(ps: T.PsString, opts: T.TextOptions): string { - const p = opts.diacritics - ? (phoneticsToDiacritics(ps.p, ps.f) || ps.p) - : ps.p; - return convertSpelling(p, opts.spelling); - } - const style = opts.pTextSize === "normal" - ? undefined - : { fontSize: opts.pTextSize === "larger" ? "large" : "larger" }; - return ( - - {(typeof text.p !== "string" && typeof text.f !== "string") - ? - psJSXMap( - text as T.PsJSX, - "p", - (ps: T.PsString) => convertText(ps, opts), - ) - : - convertText(text as T.PsString, opts) - } - - ); + function convertText(ps: T.PsString, opts: T.TextOptions): string { + const p = opts.diacritics + ? phoneticsToDiacritics(ps.p, ps.f) || ps.p + : ps.p; + return convertSpelling(p, opts.spelling); + } + const style = + opts.pTextSize === "normal" + ? undefined + : { fontSize: opts.pTextSize === "larger" ? "large" : "larger" }; + return ( + + {typeof text.p !== "string" && typeof text.f !== "string" + ? psJSXMap(text as T.PsJSX, "p", (ps: T.PsString) => + convertText(ps, opts) + ) + : convertText(text as T.PsString, opts)} + + ); }; export default Pashto; diff --git a/src/lib/package.json b/src/lib/package.json index 54604df..1343aeb 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "7.0.3", + "version": "7.0.4", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/misc-helpers.ts b/src/lib/src/misc-helpers.ts index 9e1596a..d48b1a6 100644 --- a/src/lib/src/misc-helpers.ts +++ b/src/lib/src/misc-helpers.ts @@ -310,6 +310,9 @@ export function parseEc(ec: string): T.EnglishVerbConjugationEc { if (s === "be") { return ["am", "is", "being", "was", "been"]; } + if (s === "give") { + return ["give", "gives", "giving", "gave", "gave"]; + } if (s.slice(-1) === "y" && !isVowel(s.slice(-2)[0])) { const b = s.slice(0, -1); return [`${s}`, `${b}ies`, `${s}ing`, `${b}ied`, `${b}ied`];