From fa9dfabd975da9f39da90d8be8499cfee46484c8 Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Thu, 19 Apr 2012 22:34:36 -0500 Subject: [PATCH] better markmin, video, audio, embed, iframe support --- VERSION | 2 +- applications/welcome/static/css/web2py.css | 2 ++ applications/welcome/views/layout.html | 1 + gluon/contrib/markmin/markmin2html.py | 13 +++++++------ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 937309b7..45887f96 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.7 (2012-04-19 11:12:22) dev +Version 1.99.7 (2012-04-19 22:33:54) dev diff --git a/applications/welcome/static/css/web2py.css b/applications/welcome/static/css/web2py.css index ee8f1b07..1c7e83c1 100644 --- a/applications/welcome/static/css/web2py.css +++ b/applications/welcome/static/css/web2py.css @@ -30,6 +30,8 @@ strong { font-weight: bold; } small { font-size: 0.8em; } textarea { width: 100%; } code { font-family: Courier;} +video { width:400px; } +audio { width:200px; } input[type=text], input[type=password], select { width: 300px; margin-right: 5px } ul { list-style-type: none; margin: 0px; padding: 0px; } .hidden {display:none;visibility:visible} diff --git a/applications/welcome/views/layout.html b/applications/welcome/views/layout.html index 45e50432..7f7df6dc 100644 --- a/applications/welcome/views/layout.html +++ b/applications/welcome/views/layout.html @@ -70,6 +70,7 @@ uncomment to load jquery-ui //--> + {{block head}}{{end}}
diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py index 8195cd75..f4908324 100755 --- a/gluon/contrib/markmin/markmin2html.py +++ b/gluon/contrib/markmin/markmin2html.py @@ -285,6 +285,7 @@ regex_link_popup = re.compile('\[\[(?P[^\]]*?) +(?P\S+) popup\]\]') regex_link_no_anchor = re.compile('\[\[ +(?P\S+)\]\]') regex_qr = re.compile('(?/=])qr:(?P\w+://[\w\.\-\+\?&%\/\:]+)',re.M) regex_embed = re.compile('(?/=])embed:(?P\w+://[\w\.\-\+\?&%\/\:]+)',re.M) +regex_iframe = re.compile('(?/=])iframe:(?P\w+://[\w\.\-\+\?&%\/\:]+)',re.M) regex_auto_image = re.compile('(?/=])(?P\w+://\S+\.(jpeg|jpg|gif|png)(\?\S+)?)',re.M) regex_auto_video = re.compile('(?/=])(?P\w+://\S+\.(mp4|mpeg|mov)(\?\S+)?)',re.M) regex_auto_audio = re.compile('(?/=])(?P\w+://\S+\.(mp3|wav)(\?\S+)?)',re.M) @@ -342,9 +343,9 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None): '

this is an image

' >>> render('[[this is an image http://example.com video]]') - '

' + '

' >>> render('[[this is an image http://example.com audio]]') - '

' + '

' >>> render('[[this is a **link** http://example.com]]') '

this is a link

' @@ -424,14 +425,14 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None): text = regex_image_width.sub('\g<t>', text) text = regex_image_center.sub('

\g<t>

', text) text = regex_image.sub('\g<t>', text) - text = regex_video.sub('', text) - text = regex_audio.sub('', text) + text = regex_video.sub('', text) + text = regex_audio.sub('', text) text = regex_link_popup.sub('\g', text) text = regex_link_no_anchor.sub('\g', text) text = regex_link.sub('\g', text) text = regex_qr.sub('qr code',text) - text = regex_embed.sub('', - text) + text = regex_iframe.sub('',text) + text = regex_embed.sub('\g',text) text = regex_auto_image.sub('', text) text = regex_auto_video.sub('', text) text = regex_auto_audio.sub('', text)