From 44b0297d3a0d81b77355c72364a5ed58511195be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20Oszcz=C4=99da?= Date: Sun, 24 Nov 2024 01:47:07 +0000 Subject: [PATCH] fix: Sectioned etymologies not working. --- src/constants/patterns.ts | 2 +- test/index.spec.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/constants/patterns.ts b/src/constants/patterns.ts index 7f5f203..90e30fc 100644 --- a/src/constants/patterns.ts +++ b/src/constants/patterns.ts @@ -2,7 +2,7 @@ export default { multipleWhitespace: /\s{2,}/g, // e.g. "Etymology" -> "Etymology", undefined // e.g. "Etymology 1" -> "Etymology", "1" - sectionName: /^([a-zA-Z ]+)(?: ([0-9]{1,}))?$/, + sectionName: /^([a-zA-Z ]+)(?: ([0-9]{1,}(?:\.[0-9]{1,})*?))?$/, // e.g. "Sample sentence." -> undefined, "Sample sentence." // e.g. "(historical, uncommon, regional) Sample sentence." -> "historical, uncommon, regional", "Sample sentence." withPrefixedLabels: /^(?:\(([^()]+)\) ?)? ?(.+)$/, diff --git a/test/index.spec.ts b/test/index.spec.ts index 71820a9..a15b4a0 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -54,4 +54,11 @@ describe("The parser", () => { expect(results).to.not.be.undefined; expect(results).to.be.at.of.length.at.least(13); }); + + it("returns results for words written in other scripts than Latin.", async () => { + const results = await Wiktionary.get("أدرك", { lemmaLanguage: "Arabic" }); + + expect(results).to.not.be.undefined; + expect(results).to.be.at.of.length.at.least(1); + }); });