Show More
@@ -239,10 +239,7 b' class JournalController(BaseController):' | |||||
239 |
|
239 | |||
240 | def desc(desc): |
|
240 | def desc(desc): | |
241 | from pylons import tmpl_context as c |
|
241 | from pylons import tmpl_context as c | |
242 |
|
|
242 | return h.urlify_text(desc, truncate=60, stylize=c.visual.stylify_metatags) | |
243 | return h.urlify_text(h.desc_stylize(h.truncate(desc, 60))) |
|
|||
244 | else: |
|
|||
245 | return h.urlify_text(h.truncate(desc, 60)) |
|
|||
246 |
|
243 | |||
247 | def repo_actions(repo_name): |
|
244 | def repo_actions(repo_name): | |
248 | return _render('repo_actions', repo_name) |
|
245 | return _render('repo_actions', repo_name) |
@@ -1273,10 +1273,15 b' def _urlify_text(s):' | |||||
1273 | return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full}) |
|
1273 | return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full}) | |
1274 | return url_re.sub(url_func, s) |
|
1274 | return url_re.sub(url_func, s) | |
1275 |
|
1275 | |||
1276 | def urlify_text(s): |
|
1276 | def urlify_text(s, truncate=None, stylize=False, truncatef=truncate): | |
1277 | """ |
|
1277 | """ | |
1278 | Extract urls from text and make literal html links out of them |
|
1278 | Extract urls from text and make literal html links out of them | |
1279 | """ |
|
1279 | """ | |
|
1280 | if truncate is not None: | |||
|
1281 | s = truncatef(s, truncate) | |||
|
1282 | s = html_escape(s) | |||
|
1283 | if stylize: | |||
|
1284 | s = desc_stylize(s) | |||
1280 | s = _urlify_text(s) |
|
1285 | s = _urlify_text(s) | |
1281 | return literal(s) |
|
1286 | return literal(s) | |
1282 |
|
1287 |
@@ -209,10 +209,7 b' class RepoModel(BaseModel):' | |||||
209 | cs_cache.get('message')) |
|
209 | cs_cache.get('message')) | |
210 |
|
210 | |||
211 | def desc(desc): |
|
211 | def desc(desc): | |
212 |
|
|
212 | return h.urlify_text(desc, truncate=60, stylize=c.visual.stylify_metatags) | |
213 | return h.urlify_text(h.desc_stylize(h.html_escape(h.truncate(desc, 60)))) |
|
|||
214 | else: |
|
|||
215 | return h.urlify_text(h.html_escape(h.truncate(desc, 60))) |
|
|||
216 |
|
213 | |||
217 | def state(repo_state): |
|
214 | def state(repo_state): | |
218 | return _render("repo_state", repo_state) |
|
215 | return _render("repo_state", repo_state) |
@@ -59,11 +59,7 b'' | |||||
59 | </a> |
|
59 | </a> | |
60 | </div> |
|
60 | </div> | |
61 | </td> |
|
61 | </td> | |
62 |
|
|
62 | <td>${h.urlify_text(gr.group_description, stylize=c.visual.stylify_metatags)}</td> | |
63 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> |
|
|||
64 | %else: |
|
|||
65 | <td>${gr.group_description}</td> |
|
|||
66 | %endif |
|
|||
67 | ## this is commented out since for multi nested repos can be HEAVY! |
|
63 | ## this is commented out since for multi nested repos can be HEAVY! | |
68 | ## in number of executed queries during traversing uncomment at will |
|
64 | ## in number of executed queries during traversing uncomment at will | |
69 | ##<td><b>${gr.repositories_recursive_count}</b></td> |
|
65 | ##<td><b>${gr.repositories_recursive_count}</b></td> |
@@ -84,11 +84,7 b" summary = lambda n:{False:'summary-short" | |||||
84 | <div class="label-summary"> |
|
84 | <div class="label-summary"> | |
85 | <label>${_('Description')}:</label> |
|
85 | <label>${_('Description')}:</label> | |
86 | </div> |
|
86 | </div> | |
87 | %if c.visual.stylify_metatags: |
|
87 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.db_repo.description, stylize=c.visual.stylify_metatags)}</div> | |
88 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(h.html_escape(c.db_repo.description)))}</div> |
|
|||
89 | %else: |
|
|||
90 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.html_escape(c.db_repo.description))}</div> |
|
|||
91 | %endif |
|
|||
92 | </div> |
|
88 | </div> | |
93 |
|
89 | |||
94 | <div class="field"> |
|
90 | <div class="field"> |
@@ -189,14 +189,14 b' class TestLibs(BaseTestCase):' | |||||
189 | "[requires => url] [lang => python] [just a tag]" |
|
189 | "[requires => url] [lang => python] [just a tag]" | |
190 | "[,d] [ => ULR ] [obsolete] [desc]]" |
|
190 | "[,d] [ => ULR ] [obsolete] [desc]]" | |
191 | ) |
|
191 | ) | |
192 |
from kallithea.lib.helpers import |
|
192 | from kallithea.lib.helpers import urlify_text | |
193 | res = desc_stylize(html_escape(sample)) |
|
193 | res = urlify_text(sample, stylize=True) | |
194 |
self.assert |
|
194 | self.assertIn('<div class="metatag" tag="tag">tag</div>', res) | |
195 |
self.assert |
|
195 | self.assertIn('<div class="metatag" tag="obsolete">obsolete</div>', res) | |
196 |
self.assert |
|
196 | self.assertIn('<div class="metatag" tag="stale">stale</div>', res) | |
197 |
self.assert |
|
197 | self.assertIn('<div class="metatag" tag="lang">python</div>', res) | |
198 |
self.assert |
|
198 | self.assertIn('<div class="metatag" tag="requires">requires => <a href="/url">url</a></div>', res) | |
199 |
self.assert |
|
199 | self.assertIn('<div class="metatag" tag="tag">tag</div>', res) | |
200 |
|
200 | |||
201 | def test_alternative_gravatar(self): |
|
201 | def test_alternative_gravatar(self): | |
202 | from kallithea.lib.helpers import gravatar_url |
|
202 | from kallithea.lib.helpers import gravatar_url |
General Comments 0
You need to be logged in to leave comments.
Login now