cgiffard / Downsize

Tag safe text truncation for HTML and XML!
BSD 3-Clause "New" or "Revised" License
41 stars 13 forks source link

Entities and smart quotes cause erroneous results #29

Open claviska opened 7 years ago

claviska commented 7 years ago

Not sure if this is an easy fix or not. If a word has smart quotes (either raw or entities) it will be split.

Examples:

// With smart quotes
downsize('<p>This <em>isn’t</em> right.</p>', { 
  words: 2 
})  // outputs: <p>This <em>isn’</em></p>

// With smart quotes are HTML entities
downsize('<p>This <em>isn&rsquo;t</em> right.</p>', { 
  words: 2 
}) // outputs: <p>This <em>isn&</em></p>

I'm also curious to know if Downsize still being maintained (asking because last commit was in 2014). Thanks!