- text = params # default
- classattr = ''
- if ss_class:
- classattr += 'class="%s" ' % ss_class
- # Prevent crawlers from following links potentially added by spammers or to generated pages
- if ss_class == 'external' or ss_class == 'navlink':
- classattr += 'rel="nofollow" '
- if authentication:
- path = privileged_path()
+ text = humanlink(params)
+ elif img_re.match(text):
+ text = '<img border="0" src="' + relative_url(text) + '" alt="' + text + '" />'
+
+ if not link_class:
+ if is_external_url(params):
+ link_class = 'external'
+ elif file_re.match(params) and Page(params).exists():
+ link_class = 'wikilink'
+ else:
+ params = nonexist_pfx + params
+ link_class = 'nonexistent'
+
+ classattr = 'class="%s" ' % link_class
+ # Prevent crawlers from following links potentially added by spammers or to generated pages
+ if link_class == 'external' or link_class == 'navlink':
+ classattr += 'rel="nofollow"'
+
+ return '<a %shref="%s">%s</a>' % (classattr, relative_url(params, privileged=privileged), text)
+
+def link_inline(name, descr=None, kvargs={}):
+ if not descr: descr = humanlink(name)
+ url = relative_url(name)
+ if video_re.match(name):
+ return '<video src="%s">Your browser does not support the HTML5 video tag</video>' % url
+ elif img_re.match(name):
+ return '<a href="%s"><img border="0" src="%s" alt="%s" /></a>' % (url, url + url_args(kvargs), descr)
+ elif file_re.match(name) and not ext_re.search(name): # FIXME: this guesses a wiki page
+ return Page(name).send_naked()