diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -1254,6 +1254,12 @@ _URLIFY_RE = re.compile(r''' (?[0-9a-f]{12,40}) (?!\w|[-_]) | +# Markup of *bold text* +(?: + (?:^|(?<=\s)) + (?P [*] (?!\s) [^*\n]* (?[a-zA-Z0-9\/\=\?\&\ \:\/\.\-]*)\] | \[license\ \=>\ *(?P[a-zA-Z0-9\/\=\?\&\ \:\/\.\-]*)\] | @@ -1289,6 +1295,9 @@ def urlify_text(s, repo_name=None, link_ 'url': url('changeset_home', repo_name=repo_name, revision=hash_), 'hash': hash_, } + bold = match_obj.group('bold') + if bold is not None: + return '*%s*' % _urlify(bold[1:-1]) if stylize: seen = match_obj.group('seen') if seen: diff --git a/kallithea/tests/other/test_libs.py b/kallithea/tests/other/test_libs.py --- a/kallithea/tests/other/test_libs.py +++ b/kallithea/tests/other/test_libs.py @@ -352,6 +352,19 @@ class TestLibs(TestController): ("deadbeefcafe 123412341234", """deadbeefcafe 123412341234""", ""), + ("We support * markup for *bold* markup of *single or multiple* words, " + "*a bit @like http://slack.com*. " + "The first * must come after whitespace and not be followed by whitespace, " + "contain anything but * and newline until the next *, " + "which must not come after whitespace " + "and not be followed by * or alphanumerical *characters*.", + """We support * markup for *bold* markup of *single or multiple* words, """ + """*a bit @like http://slack.com*. """ + """The first * must come after whitespace and not be followed by whitespace, """ + """contain anything but * and newline until the next *, """ + """which must not come after whitespace """ + """and not be followed by * or alphanumerical *characters*.""", + "-"), # tags are covered by test_tag_extractor ]) def test_urlify_test(self, sample, expected, url_):