From: Bernie Innocenti Date: Wed, 8 Apr 2009 20:58:08 +0000 (+0200) Subject: Factor out code to generate inline links X-Git-Tag: v4.0~9^2~10 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=b36435d29f2dcaf6d3a2d19d21ca8b3c2c62c44d;p=geekigeeki.git Factor out code to generate inline links --- diff --git a/geekigeeki.py b/geekigeeki.py index 081517a..f3ce1dc 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -3,7 +3,7 @@ # # Copyright 1999, 2000 Martin Pool # Copyright 2002 Gerardo Poggiali -# Copyright 2007, 2008 Bernie Innocenti +# Copyright 2007, 2008, 2009 Bernie Innocenti # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -206,6 +206,13 @@ def link_tag(params, text=None, link_class=None, privileged=False): return '%s' % (classattr, relative_url(params, privileged=privileged), text) +def link_inline(name, descr=None, args=''): + if not descr: descr = name + if video_re.match(name): + return '' % name + else: + return '%s' % (name, name + args, descr) + # Search --------------------------------------------------- def handle_fullsearch(needle): @@ -392,12 +399,11 @@ class WikiFormatter: args = '?' + '&'.join(argv) # The "extthumb" nonsense works around a limitation of the HTML block model - return '
%s
%s
' \ - % (name, name + args, descr, descr) - elif video_re.match(name): - return '' % name + return '
' \ + + link_inline(name, descr, args) \ + + '
' + descr + '
' else: - return '' % (name, name) + return link_inline(name, name) def _html_repl(self, word): self.in_html += 1