diff --git a/kallithea/controllers/journal.py b/kallithea/controllers/journal.py --- a/kallithea/controllers/journal.py +++ b/kallithea/controllers/journal.py @@ -239,10 +239,7 @@ class JournalController(BaseController): def desc(desc): from pylons import tmpl_context as c - if c.visual.stylify_metatags: - return h.urlify_text(h.desc_stylize(h.truncate(desc, 60))) - else: - return h.urlify_text(h.truncate(desc, 60)) + return h.urlify_text(desc, truncate=60, stylize=c.visual.stylify_metatags) def repo_actions(repo_name): return _render('repo_actions', repo_name) diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -1273,10 +1273,15 @@ def _urlify_text(s): return '%(url)s' % ({'url': url_full}) return url_re.sub(url_func, s) -def urlify_text(s): +def urlify_text(s, truncate=None, stylize=False, truncatef=truncate): """ Extract urls from text and make literal html links out of them """ + if truncate is not None: + s = truncatef(s, truncate) + s = html_escape(s) + if stylize: + s = desc_stylize(s) s = _urlify_text(s) return literal(s) diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py --- a/kallithea/model/repo.py +++ b/kallithea/model/repo.py @@ -209,10 +209,7 @@ class RepoModel(BaseModel): cs_cache.get('message')) def desc(desc): - if c.visual.stylify_metatags: - return h.urlify_text(h.desc_stylize(h.html_escape(h.truncate(desc, 60)))) - else: - return h.urlify_text(h.html_escape(h.truncate(desc, 60))) + return h.urlify_text(desc, truncate=60, stylize=c.visual.stylify_metatags) def state(repo_state): return _render("repo_state", repo_state) diff --git a/kallithea/templates/index_base.html b/kallithea/templates/index_base.html --- a/kallithea/templates/index_base.html +++ b/kallithea/templates/index_base.html @@ -59,11 +59,7 @@ - %if c.visual.stylify_metatags: -