# 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|bmp|ico)$", re.IGNORECASE)
+video_re = re.compile(r"^.*\.(ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt)$", re.IGNORECASE)
url_re = re.compile(r"^[a-z]{3,8}://[^\s'\"]+\S$")
link_re = re.compile("(?:\[\[|{{)([^\s\|]+)(?:\s*\|\s*([^\]]+)|)(?:\]\]|}})")
def _inl_repl(self, word):
m = link_re.match(word)
- name = m.group(1)
- descr = m.group(2) or name
- name = relative_url(name)
- argv = descr.split('|')
- descr = argv.pop(0)
+ name = relative_url(m.group(1))
+ descr = m.group(2)
- if argv:
- args = '?' + '&'.join(argv)
- else:
+ if descr:
+ argv = descr.split('|')
+ descr = argv.pop(0)
args = ''
+ if argv:
+ args = '?' + '&'.join(argv)
- if descr:
# The "extthumb" nonsense works around a limitation of the HTML block model
return '<div class="extthumb"><div class="thumb"><a href="%s"><img border="0" src="%s" alt="%s" /></a><div class="caption">%s</div></div></div>' \
% (name, name + args, descr, descr)
+ elif video_re.match(name):
+ return '<video src="%s">Your browser does not support the HTML5 video tag</video>' % name
else:
- return '<a href="%s"><img border="0" src="%s" /></a>' % (name, name + args)
+ return '<a href="%s"><img border="0" src="%s" /></a>' % (name, name)
def _email_repl(self, word):
return '<a href="mailto:%s">%s</a>' % (word, word)