huang47 / nodejs-html-truncate

truncate html text and keep tag safe
77 stars 30 forks source link

Fixes end truncate behavior #10

Closed tildedave closed 9 years ago

tildedave commented 9 years ago

The issue seems to be from the line:

            if (total + index > maxLength) {
                // exceed given `maxLength`, dump everything to clear stack
                content += (string.substring(0, maxLength - total));

If the "dump everything" happens then it doesn't add an ellipsis

I used the example from #9 for the unit test, thanks @GriffinHeart

tildedave commented 9 years ago

This may also not be the right behavior (tests pass tho)

tildedave commented 9 years ago

Node 0.8 tests appear to be failing because it can't find a version of coveralls that is compatible with that node version

GriffinHeart commented 9 years ago

:+1:

forestbelton commented 9 years ago

:+1:

tildedave commented 9 years ago

So apparently Github closed this for me when I had my project point to my forked repo. Whoops.

levity commented 9 years ago

thanks! this works for me too.

huang47 commented 9 years ago

LGTM, thanks for the PR