diff --git a/textile/core.py b/textile/core.py index 6454187..ea94ac1 100644 --- a/textile/core.py +++ b/textile/core.py @@ -25,8 +25,9 @@ from textile.regex_strings import (align_re_s, cls_re_s, pnct_re_s, regex_snippets, syms_re_s, table_span_re_s) from textile.utils import (decode_high, encode_high, encode_html, generate_tag, - has_raw_text, is_rel_url, is_valid_url, list_type, - normalize_newlines, parse_attributes, pba) + has_raw_text, human_readable_url, is_rel_url, + is_valid_url, list_type, normalize_newlines, + parse_attributes, pba) from textile.objects import Block, Table try: @@ -139,14 +140,6 @@ def make_glyph_replacers(html_type, uid, glyph_defs): for (regex_obj, replacement) in pre_result] -def human_readable_url(url): - if "://" in url: - url = url.split("://")[1] - elif ":" in url: - url = url.split(":")[1] - return url - - class Textile(object): restricted_url_schemes = ('http', 'https', 'ftp', 'mailto') unrestricted_url_schemes = restricted_url_schemes + ( diff --git a/textile/utils.py b/textile/utils.py index 1a04182..7045bcb 100644 --- a/textile/utils.py +++ b/textile/utils.py @@ -89,6 +89,14 @@ def has_raw_text(text): return r != '' +def human_readable_url(url): + if "://" in url: + url = url.split("://")[1] + elif ":" in url: + url = url.split(":")[1] + return url + + def is_rel_url(url): """Identify relative urls.""" (scheme, netloc) = urlparse(url)[0:2]