# Path: airy/utils/html.py
# def strip_tags(value):
#     """Returns the given HTML with all tags stripped."""
#     return re.sub(r'<[^>]*?>', '', force_unicode(value))
# 
# Path: airy/utils/encoding.py
# def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a unicode object representing 's'. Treats bytestrings using the
#     'encoding' codec.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if isinstance(s, Promise):
#         # The input is the result of a gettext_lazy() call.
#         return s
#     return force_unicode(s, encoding, strings_only, errors)


import copy
import logging
import re
    import lxml.html
from airy.utils.html import strip_tags
from airy.utils.encoding import smart_unicode
        from airy.core import sanitizer

            if url != before_clip:
                amp = url.rfind('&')
                # avoid splitting html char entities
                if amp > max_len - 5:
                    url = url[:amp]
                url += "..."

                if len(url) >= len(before_clip):
                    url = before_clip
                else:
                    # full url is visible on mouse-over (for those who don't
                    # have a status bar, such as Safari by default)
                    params += ' title="%s"' % href

        return u'<a href="%s"%s>%s</a>' % (href, params, url)

    try:
        text = text.replace('http://www.', 'www.').replace('www.', 'http://www.')
        return _autolink_html(text, _link_regexes, extra_params=extra_params)
    except ImportError:
        pass

    splitted_text = re.split("""(<a.*?>.*?</a>)""", text)
    for i in range(0, len(splitted_text), 2):
        splitted_text[i] = _URL_RE.sub(make_link, splitted_text[i])

    # The regex is modified to avoid character entites other than &amp; so
    # that we won't pick up &quot;, etc.
#    return _URL_RE.sub(make_link, text)

# Path: airy/utils/html.py
# def strip_tags(value):
#     """Returns the given HTML with all tags stripped."""
#     return re.sub(r'<[^>]*?>', '', force_unicode(value))
# 
# Path: airy/utils/encoding.py
# def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
#     """
#     Returns a unicode object representing 's'. Treats bytestrings using the
#     'encoding' codec.
# 
#     If strings_only is True, don't convert (some) non-string-like objects.
#     """
#     if isinstance(s, Promise):
#         # The input is the result of a gettext_lazy() call.
#         return s
#     return force_unicode(s, encoding, strings_only, errors)


# Path: airy/core/markup.py
import copy
import logging
import re
    import lxml.html
from airy.utils.html import strip_tags
from airy.utils.encoding import smart_unicode
        from airy.core import sanitizer


            if url != before_clip:
                amp = url.rfind('&')
                # avoid splitting html char entities
                if amp > max_len - 5:
                    url = url[:amp]
                url += "..."

                if len(url) >= len(before_clip):
                    url = before_clip
                else:
                    # full url is visible on mouse-over (for those who don't
                    # have a status bar, such as Safari by default)
                    params += ' title="%s"' % href

        return u'<a href="%s"%s>%s</a>' % (href, params, url)

    try:
        text = text.replace('http://www.', 'www.').replace('www.', 'http://www.')
        return _autolink_html(text, _link_regexes, extra_params=extra_params)
    except ImportError:
        pass

    splitted_text = re.split("""(<a.*?>.*?</a>)""", text)
    for i in range(0, len(splitted_text), 2):
        splitted_text[i] = _URL_RE.sub(make_link, splitted_text[i])

    # The regex is modified to avoid character entites other than &amp; so
    # that we won't pick up &quot;, etc.
#    return _URL_RE.sub(make_link, text)

    return smart_unicode(''.join(splitted_text))