allow spaces in filenames
[geekigeeki.git] / geekigeeki.py
index 44b5131bb1435a0e2781f56a8583e108b52b0b75..3afc3e8a3ea3ec7144264489597f4afed0aebdaa 100755 (executable)
@@ -25,7 +25,7 @@ video_ext = "ogg|ogv|oga" # Not supported by Firefox 3.5: mkv|mpg|mpeg|mp4|avi|a
 image_re = re.compile(r".*\.(" + image_ext + "|" +  video_ext + ")$", re.IGNORECASE)
 video_re = re.compile(r".*\.(" + video_ext + ")$", re.IGNORECASE)
 # FIXME: we accept stuff like foo/../bar and we shouldn't
-file_re  = re.compile(r"([A-Za-z0-9_\-][A-Za-z0-9_\.\-/]*)$")
+file_re  = re.compile(r"([A-Za-z0-9_\-][A-Za-z0-9_\.\-/ ]*)$")
 url_re   = re.compile(r"[a-z]{3,8}://[^\s'\"]+\S$")
 ext_re   = re.compile(r"\.([^\./]+)$")
 
@@ -120,7 +120,7 @@ def send_guru(msg_text, msg_type):
     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>' \
+    print('</pre><script type="text/javascript" src="%s" defer="defer"></script>' \
         % relative_url('sys/GuruMeditation.js'))
 
 def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=False, mtime=None):
@@ -556,8 +556,8 @@ class WikiFormatter:
             | (?P<glyph> --)
 
             # Links
-            | (?P<macro> \<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>)
-            | (?P<hurl>  \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])
+            | (?P<macro> \<\<[^\>]+\>\>)
+            | (?P<hurl>  \[\[[^\]]+\]\])
 
             # Inline HTML
             | (?P<html>             <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b )
@@ -573,7 +573,7 @@ class WikiFormatter:
             # Lists, divs, spans and inline objects
             | (?P<li>    ^\s+[\*\#]\s+)
             | (?P<pre>   \{\{\{|\s*\}\}\})
-            | (?P<inl>   \{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})
+            | (?P<inl>   \{\{[^\}]+\}\})
 
             # Tables
             | (?P<tr>    ^\s*\|\|(=|)\s*)