Skip to content

Commit

Permalink
fix: Sectioned etymologies not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
vxern committed Nov 24, 2024
1 parent e163d46 commit 44b0297
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/constants/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: /^(?:\(([^()]+)\) ?)? ?(.+)$/,
Expand Down
7 changes: 7 additions & 0 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 44b0297

Please sign in to comment.