Truncates given text (html-aware)
    Sample usage::

        {% truncate 60 %}
             {{ some_text }}
        {% more %}
             <a href="asdasd">Read more..</a>
        {% endtruncate %}

def do_truncate(parser, token):
    """
    Truncates given text (html-aware)
    Sample usage::

        {% truncate 60 %}
             {{ some_text }}
        {% more %}
             <a href="asdasd">Read more..</a>
        {% endtruncate %}
    """
    _, count = token.split_contents()

    nodelist = parser.parse(('more', 'endtruncate',))
    token = parser.next_token()
    if token.contents == 'more':
        nodelist_more = parser.parse(('endtruncate',))
        parser.delete_first_token()
    else:
        nodelist_more = None
    return TruncateNode(count, nodelist, nodelist_more)