Skip to content

Commit

Permalink
Fix: self conversion: eta_i handling with useCxOverMacron and mul…
Browse files Browse the repository at this point in the history
…tiple accents
  • Loading branch information
antoineboquet committed Mar 10, 2024
1 parent a22214c commit 9859273
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/toTransliteration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ export function toTransliteration(
}

if (eta_i) {
str = str.replace(/ē/gi, (m) => (m.toUpperCase() === m ? 'Ī' : 'ī'));
str = str
.normalize('NFD')
.replace(/(e)(\p{M}+)/giu, (m, $1, $2) => {
if ((useCxOverMacron && /\u0302/.test(m)) || /\u0304/.test(m)) {
return $1.toUpperCase() === $1 ? 'I' + $2 : 'i' + $2;
}
return m;
})
.normalize();
}

if (xi_ks) {
Expand Down

0 comments on commit 9859273

Please sign in to comment.