comparison MoinMoin/theme/__init__.py @ 3086:dafb1b4e75e5

theme code: use url_schemas from config
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 00:32:35 +0100
parents ed1a433803c6
children 0c0fd7c894a3
comparison
equal deleted inserted replaced
3085:fdb68a8f92da 3086:dafb1b4e75e5
291 291
292 userlinks = [u'<li>%s</li>' % link for link in userlinks] 292 userlinks = [u'<li>%s</li>' % link for link in userlinks]
293 html = u'<ul id="username">%s</ul>' % ''.join(userlinks) 293 html = u'<ul id="username">%s</ul>' % ''.join(userlinks)
294 return html 294 return html
295 295
296 # Schemas supported in toolbar links, using [url label] format
297 linkSchemas = [r'http://', r'https://', r'ftp://', 'mailto:', r'irc://', r'ircs://', ] + \
298 [x + ':' for x in config.url_schemas]
299
300 def splitNavilink(self, text, localize=1): 296 def splitNavilink(self, text, localize=1):
301 """ Split navibar links into pagename, link to page 297 """ Split navibar links into pagename, link to page
302 298
303 Admin or user might want to use shorter navibar items by using 299 Admin or user might want to use shorter navibar items by using
304 the [[page|title]] or [[url|title]] syntax. In this case, we don't 300 the [[page|title]] or [[url|title]] syntax. In this case, we don't
332 # Just use the text as is. 328 # Just use the text as is.
333 pagename = text.strip() 329 pagename = text.strip()
334 else: 330 else:
335 pagename = text 331 pagename = text
336 332
337 for scheme in self.linkSchemas: 333 for scheme in config.url_schemas:
338 if pagename.startswith(scheme): 334 if pagename.startswith(scheme + ':'):
339 if not title: 335 if not title:
340 title = pagename 336 title = pagename
341 title = wikiutil.escape(title) 337 title = wikiutil.escape(title)
342 link = fmt.url(1, pagename) + fmt.text(title) + fmt.url(0) 338 link = fmt.url(1, pagename) + fmt.text(title) + fmt.url(0)
343 return pagename, link 339 return pagename, link