discourse/discourse — pull request #837 by ZogStriP (2013-05-10 10:36:38+00:00)
Title: FIX: pinned topic excerpt is not properly truncated

Meta: [Limiting the size of pinned topic excerpts](http://meta.discourse.org/t/limiting-the-size-of-pinned-topic-excerpts/6522)

Prevent this from happening:

![35279e0133a067a2 1](https://f.cloud.github.com/assets/362783/487499/abd70258-b95c-11e2-8004-165ebbb28d73.png)

The issue was that there was an edge-case that wasn't taken into account when truncating the html of the first post.

```ruby
@excerpt << encode.call(string[0..(@length-@current_length)-1]) if truncate
```
would return the **whole** string when `@length == @current_length` instead of *truncating* it.