From: Bernardo Innocenti Date: Sat, 5 Jan 2008 21:02:00 +0000 (+0100) Subject: Simplify/generalize linking X-Git-Tag: v3.0~40 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=cb4160fc9e77f9fe29bca28ed504ca38dac94089;p=geekigeeki.git Simplify/generalize linking --- diff --git a/geekigeeki.py b/geekigeeki.py index 9c9efc1..84f1db5 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -171,6 +171,8 @@ def link_tag(params, text=None, ss_class=None, privileged=False): # Prevent crawlers from following links potentially added by spammers or to generated pages if ss_class == 'external' or ss_class == 'navlink': classattr += 'rel="nofollow" ' + elif url_re.match(params): + classattr += 'rel="nofollow" ' return '%s' % (classattr, relative_url(params, privileged=privileged), text) # Search --------------------------------------------------- @@ -402,18 +404,14 @@ class PageFormatter: if macro: return apply(macro, (name, descr)) elif img_re.match(name): + name = relative_url(name) # The "extthumb" nonsense works around a limitation of the HTML block model return '
%s
%s
' % (name, name, descr, descr) else: if img_re.match(descr): descr = '' - if url_re.match(name): - return '%s' % (name, descr) - elif name.startswith('/'): - return '%s' % (name, descr) - else: - return link_tag(name, descr, 'wikilink') + return link_tag(name, descr, 'wikilink') def _email_repl(self, word): return '%s' % (word, word)