start_time = clock()
title_done = False
-import cgi, sys, os, re, errno, stat
+import cgi, sys, os, re, errno, stat, glob
image_ext = 'png|gif|jpg|jpeg|bmp|ico'
video_ext = "ogg|ogv|oga" # Not supported by Firefox 3.5: mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt
print('<pre id="guru" onclick="this.style.display = \'none\'" class="' + msg_type + '">')
if msg_type == 'error':
print(' Software Failure. Press left mouse button to continue.\n')
- print(msg_text)
+ print(cgi.escape(msg_text))
if msg_type == 'error':
print '\n Guru Meditation #DEADBEEF.ABADC0DE'
print('</pre><script language="JavaScript" type="text/javascript" src="%s" defer="defer"></script>' \
return '<iframe width="100%%" scrolling="auto" frameborder="0" src="%s"><a href="%s">%s</a></iframe>' \
% (url, url, name)
+def link_inline_glob(pattern, descr=None, kvargs={}):
+ os.chdir(config_get('data_dir', 'data'))
+ s = ''
+ for name in glob.glob(pattern):
+ s += link_inline(name, descr, kvargs)
+ return s
+
# Search ---------------------------------------------------
def print_search_stats(hits, searched):
# This double div nonsense works around a limitation of the HTML block model
return '<div class="' + kvargs.get('class', 'thumb') + '">' \
+ '<div class="innerthumb">' \
- + link_inline(name, descr, kvargs) \
+ + link_inline_glob(name, descr, kvargs) \
+ '<div class="caption">' + descr + '</div></div></div>'
else:
- return link_inline(name, None, kvargs)
+ return link_inline_glob(name, None, kvargs)
def _html_repl(self, word):
if not self.in_html and word.startswith('<div'): word = '</p>' + word