X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=44be2a46bcc3163307d0f65d62b7421b73c130f8;hb=a8cdeeed7e87a195c5e9e0b1e2b74e6b04da1109;hp=0607006331db081e90b43ceab3430f6bac4726d3;hpb=666cc43781cace3f5a662a6403bee97c46a5c3a7;p=geekigeeki.git
diff --git a/geekigeeki.py b/geekigeeki.py
index 0607006..44be2a4 100755
--- a/geekigeeki.py
+++ b/geekigeeki.py
@@ -3,7 +3,7 @@
#
# Copyright 1999, 2000 Martin Pool
# Copyright 2002 Gerardo Poggiali
-# Copyright 2007, 2008 Bernardo Innocenti
+# Copyright 2007, 2008 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
@@ -31,8 +31,9 @@ from os import path, environ
word_re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$")
# FIXME: we accept stuff like foo/../bar and we shouldn't
file_re = re.compile(r"^\b([A-Za-z0-9_\-][A-Za-z0-9_\.\-/]*)\b$")
-img_re = re.compile(r"^.*\.(png|gif|jpg|jpeg)$", re.IGNORECASE)
+img_re = re.compile(r"^.*\.(png|gif|jpg|jpeg|bmp|ico)$", re.IGNORECASE)
url_re = re.compile(r"^[a-z]{3,8}://[^\s'\"]+\S$")
+link_re = re.compile("(?:\[\[|{{)([^\s\|]+)(?:\s*\|\s*([^\]]+)|)(?:\]\]|}})")
title_done = False
@@ -126,6 +127,17 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'):
print ' '
for css in css_url:
print ' ' % relative_url(css)
+ if icon_url:
+ print ' ' % relative_url(icon_url)
+
+ if privileged_url is not None:
+ print ' ' \
+ % (privileged_path() + '?edit=' + name)
+
+ if history_url is not None:
+ print ' ' \
+ % (history_url + '?a=rss')
+
print ''
# Body
@@ -248,8 +260,8 @@ def make_index_key():
links = map(lambda ch: '%s' % (ch, ch), 'abcdefghijklmnopqrstuvwxyz')
return ''+ ' | '.join(links) + '
'
-def page_list():
- return filter(word_re.match, os.listdir(data_dir))
+def page_list(dir = None, re = word_re):
+ return filter(re.match, os.listdir(dir or data_dir))
def send_footer(name, mod_string=None):
if globals().get('debug_cgi', False):
@@ -264,7 +276,7 @@ def send_footer(name, mod_string=None):
print 'last modified %s
' % mod_string
print '