From: Bernie Innocenti Date: Tue, 18 Aug 2009 20:43:18 +0000 (+0200) Subject: Allow glob matching on inline includes X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=537829f7f5332bc5867b826312132290d5de8d14;p=geekigeeki.git Allow glob matching on inline includes --- diff --git a/geekigeeki.py b/geekigeeki.py index 36083f7..ca62bed 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -24,7 +24,7 @@ from time import clock 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 @@ -116,7 +116,7 @@ def send_guru(msg_text, msg_type): print('
')
     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('
' \ @@ -236,6 +236,13 @@ def link_inline(name, descr=None, kvargs={}): return '' \ % (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): @@ -430,10 +437,10 @@ class WikiFormatter: # This double div nonsense works around a limitation of the HTML block model return '
' \ + '
' \ - + link_inline(name, descr, kvargs) \ + + link_inline_glob(name, descr, kvargs) \ + '
' + descr + '
' 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('