bramstein / hypher

A fast and small JavaScript hyphenation engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uppercases are not hyphenated correctly

timo22345 opened this issue · comments

commented

Uppercases are not hyphenated correctly.

console.log(window['Hypher']['languages']['fi']
.hyphenateText('LÄHETÄ SÄHKÖPOSTI').replace(/\u00AD/g, '_')

gives:

"LÄHETÄ SÄHKÖPOS_TI"

but

console.log(window['Hypher']['languages']['fi']
.hyphenateText('Lähetä sähköposti').replace(/\u00AD/g, '_');

gives:

"Lä_he_tä säh_kö_pos_ti"

I got it to work by adding "i" after "g" in:

Hypher.prototype.hyphenateText = function (str, minLength) {
...
var words = str.split(/([a-zA-Z0-9_\u0027\u00DF-\u00EA
...
\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/gi);

Sorry for the late response. Thanks for reporting it, it should be fixed in v2.0.5.