From 3089b2bdb284cce0870999cfa21c060759b94ae4 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Fri, 1 May 2009 10:52:44 +0900 Subject: [PATCH] Allow specifying CSS class for thumbnails --- geekigeeki.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/geekigeeki.py b/geekigeeki.py index 368cf8d..b8aeee8 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -22,6 +22,7 @@ __version__ = '$Id$'[4:12] from time import clock start_time = clock() +title_done = False import cgi, sys, os, re, errno, stat @@ -32,8 +33,6 @@ video_re = re.compile(r"^.*\.(ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt)$", re url_re = re.compile(r"^[a-z]{3,8}://[^\s'\"]+\S$") ext_re = re.compile(r"\.([^\./]+)$") -title_done = False - # CGI stuff --------------------------------------------------------- def script_name(): return os.environ.get('SCRIPT_NAME', '') @@ -80,7 +79,7 @@ def permalink(s): return re.sub(' ', '-', re.sub('[^a-z0-9_ ]', '', s.lower()).strip()) def humanlink(s): - return re.compile('([^:/\.]+)(?:\.[^/:]+|)$').search(s).group(1).replace('_', ' ') + return re.search('([^:/\.]+)(?:\.[^/:]+|)$', s).group(1).replace('_', ' ') # Split arg lists like "blah| blah blah| width=100 | align = center", # return a list containing anonymous arguments and a map containing the named arguments @@ -264,7 +263,6 @@ def handle_fullsearch(query, form): print_search_stats(len(hits), len(all_pages)) def handle_titlesearch(query, form): - # TODO: check needle is legal -- but probably we can just accept any RE needle = form['q'].value send_title(None, 'Title search for "' + needle + '"') @@ -417,8 +415,9 @@ class WikiFormatter: name = args.pop(0) if len(args): descr = args.pop(0) - # The "extthumb" nonsense works around a limitation of the HTML block model - return '
' \ + # This double div nonsense works around a limitation of the HTML block model + return '
' \ + + '
' \ + link_inline(name, descr, kvargs) \ + '
' + descr + '
' else: @@ -651,8 +650,8 @@ class Page: for filename in page_list(self._filename(), file_re): if img_re.match(filename): if image_maxwidth: - maxwidth_arg = '|maxwidth=' + str(image_maxwidth) - out += '{{' + self.page_name + '/' + filename + '|' + humanlink(filename) + maxwidth_arg + '}}\n' + maxwidth_arg = ' | maxwidth=' + str(image_maxwidth) + out += '{{' + self.page_name + '/' + filename + ' | ' + humanlink(filename) + maxwidth_arg + ' | class=thumbleft}}\n' else: out += ' * [[' + self.page_name + '/' + filename + ']]\n' return out -- 2.25.1