Show More
@@ -177,6 +177,9 b' class MarkupRenderer(object):' | |||||
177 | JUPYTER_PAT = re.compile(r'\.(ipynb)$', re.IGNORECASE) |
|
177 | JUPYTER_PAT = re.compile(r'\.(ipynb)$', re.IGNORECASE) | |
178 | PLAIN_PAT = re.compile(r'^readme$', re.IGNORECASE) |
|
178 | PLAIN_PAT = re.compile(r'^readme$', re.IGNORECASE) | |
179 |
|
179 | |||
|
180 | URL_PAT = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]' | |||
|
181 | r'|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)') | |||
|
182 | ||||
180 | extensions = ['codehilite', 'extra', 'def_list', 'sane_lists'] |
|
183 | extensions = ['codehilite', 'extra', 'def_list', 'sane_lists'] | |
181 | markdown_renderer = markdown.Markdown( |
|
184 | markdown_renderer = markdown.Markdown( | |
182 | extensions, safe_mode=True, enable_attributes=False) |
|
185 | extensions, safe_mode=True, enable_attributes=False) | |
@@ -300,14 +303,11 b' class MarkupRenderer(object):' | |||||
300 |
|
303 | |||
301 | @classmethod |
|
304 | @classmethod | |
302 | def urlify_text(cls, text): |
|
305 | def urlify_text(cls, text): | |
303 | url_pat = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]' |
|
|||
304 | r'|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)') |
|
|||
305 |
|
||||
306 | def url_func(match_obj): |
|
306 | def url_func(match_obj): | |
307 | url_full = match_obj.groups()[0] |
|
307 | url_full = match_obj.groups()[0] | |
308 | return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full}) |
|
308 | return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full}) | |
309 |
|
309 | |||
310 |
return |
|
310 | return cls.URL_PAT.sub(url_func, text) | |
311 |
|
311 | |||
312 | @classmethod |
|
312 | @classmethod | |
313 | def plain(cls, source, universal_newline=True): |
|
313 | def plain(cls, source, universal_newline=True): |
General Comments 0
You need to be logged in to leave comments.
Login now