From cb4160fc9e77f9fe29bca28ed504ca38dac94089 Mon Sep 17 00:00:00 2001 From: Bernardo Innocenti Date: Sat, 5 Jan 2008 22:02:00 +0100 Subject: [PATCH] Simplify/generalize linking --- geekigeeki.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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) -- 2.25.1