Mercurial > kallithea
changeset 8230:563708f2275d
tests: add some doctests for urlify and markup
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 29 Nov 2019 11:47:32 +0100 |
parents | b6b6955981a5 |
children | b495947ac174 |
files | kallithea/lib/helpers.py kallithea/lib/markup_renderer.py |
diffstat | 2 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/helpers.py Fri Feb 07 01:38:30 2020 +0100 +++ b/kallithea/lib/helpers.py Fri Nov 29 11:47:32 2019 +0100 @@ -1062,6 +1062,8 @@ URLs links to what they say. Issues are linked to given issue-server. If link_ is provided, all text not already linking somewhere will link there. + >>> urlify_text("Urlify http://example.com/ and 'https://example.com' *and* <b>markup/b>") + literal('Urlify <a href="http://example.com/">http://example.com/</a> and '<a href="https://example.com&apos">https://example.com&apos</a>; <b>*and*</b> <b>markup/b>') """ def _replace(match_obj):
--- a/kallithea/lib/markup_renderer.py Fri Feb 07 01:38:30 2020 +0100 +++ b/kallithea/lib/markup_renderer.py Fri Nov 29 11:47:32 2019 +0100 @@ -150,6 +150,10 @@ @classmethod def plain(cls, source, universal_newline=True): + """ + >>> MarkupRenderer.plain('https://example.com/') + '<br /><a href="https://example.com/">https://example.com/</a>' + """ source = safe_str(source) if universal_newline: newline = '\n'