-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not work with russian language #13
Comments
Hello, the current code does this: HTML_Truncator.truncate("<p>Русский текст.</p>", 5, length_in_chars: true)
# => "<p>…</p>"
HTML_Truncator.truncate("<p>Русский текст.</p>", 7, length_in_chars: true)
# => "<p>Русский…</p>" What were your expectations? |
I expected HTML_Truncator.truncate("<p>Русский текст.</p>", 5, length_in_chars: true)
# => "<p>Русск…</p>" |
Sorry, problem not in language HTML_Truncator.truncate("<p>Russkiy tekst.</p>", 5, length_in_chars: true)
#=> "<p>…</p>" But, this is not true, why is not displayed part of a word? #=> "<p>Russk...</p>" or #=> "<p>Ru...</p>" |
Yes, as explained in the README, HTML Truncator doesn't cut inside a word but goes back to the immediately preceding word boundary. The first version of HTML Truncator was made for a website where it made more sense to cut on a number of words and not inside them. Later, someone asks me to specify the length in chars to have a more precise length, but he was still OK with not cutting words. So, I kept this behaviour. Maybe, it should be an interesting idea to cut inside words when the length is in chars. |
Cutting into words would be a nice add on switch option. e.g. |
The text was updated successfully, but these errors were encountered: