diff --git a/VERSION b/VERSION
index 779dfb3c..588d25b4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-Version 1.99.7 (2012-05-03 10:03:56) dev
+Version 1.99.7 (2012-05-03 11:13:53) dev
diff --git a/gluon/contrib/autolinks.py b/gluon/contrib/autolinks.py
index f315d0d6..082fb680 100644
--- a/gluon/contrib/autolinks.py
+++ b/gluon/contrib/autolinks.py
@@ -1,9 +1,56 @@
+"""
+Developed by Massimo Di Pierro
+Released under the web2py license (LGPL)
+
+What does it do?
+
+if html is a variable containing HTML text and urls in the text, when you call
+
+ html = expend_html(html)
+
+it automatically converts the url to links but when possible it embeds the object being linked.
+In particular it can embed images, videos, audio files, documents (it uses the google code player),
+as well as pages to a oembed service.
+
+
+Google Doc Support
+==================
+Microsoft Word (.DOC, .DOCX)
+Microsoft Excel (.XLS and .XLSX)
+Microsoft PowerPoint 2007 / 2010 (.PPTX)
+Apple Pages (.PAGES)
+Adobe PDF (.PDF)
+Adobe Illustrator (.AI)
+Adobe Photoshop (.PSD)
+Autodesk AutoCad (.DXF)
+Scalable Vector Graphics (.SVG)
+PostScript (.EPS, .PS)
+TrueType (.TTF)
+XML Paper Specification (.XPS)
+
+Oembed Support
+==============
+flickr.com
+youtube.com
+hulu.com
+vimeo.com
+slideshare.net
+qik.com
+polleverywhere.com
+wordpress.com
+revision3.com
+viddler.com
+"""
+
import re, cgi, sys
from simplejson import loads
-import BeautifulSoup
+from BeautifulSoup import BeautifulSoup
import urllib
+import uuid
-MAPS = [
+regex_link = re.compile('https?://\S+')
+
+EMBED_MAPS = [
(re.compile('http://\S*?flickr.com/\S*'),
'http://www.flickr.com/services/oembed/'),
(re.compile('http://\S*.youtu(\.be|be\.com)/watch\S*'),
@@ -18,22 +65,65 @@ MAPS = [
'http://qik.com/api/oembed.json'),
(re.compile('http://www.polleverywhere.com/\w+/\S+'),
'http://www.polleverywhere.com/services/oembed/'),
- (re.compile('http://www.slideshare.net/\w+/\S+'),
- 'http://www.slideshare.net/api/oembed/2'),
(re.compile('http://\S+.wordpress.com/\S+'),
'http://public-api.wordpress.com/oembed/'),
(re.compile('http://*.revision3.com/\S+'),
'http://revision3.com/api/oembed/'),
- (re.compile('http://www.slideshare.net/\w+/\S+'),
- 'http://api.smugmug.com/services/oembed/'),
(re.compile('http://\S+.viddler.com/\S+'),
'http://lab.viddler.com/services/oembed/'),
]
-regex_link = re.compile('https?://\S+')
+def image(url):
+ return '' % url
+
+def audio(url):
+ return '' % url
+
+def video(url):
+ return '' % url
+
+def googledoc_viewer(url):
+ return '' % urllib.quote(url)
+
+def web2py_component(url):
+ code = str(uuid.uuid4())
+ return '
http://www.youtube.com/watch?v=IWBFiI5RrA0
+http://www.web2py.com/examples/static/images/logo_bw.png
+http://www.web2py.com/examples/default/index.load
+http://www.web2py.com/examples/static/web2py_manual_cutl.pdf
Elementum sodales est varius magna leo sociis erat. Nascetur pretium non ultricies gravida. Condimentum at nascetur tempus. Porttitor viverra ipsum accumsan neque aliquet. Ultrices vestibulum tempor quisque eget sem eget. Ornare malesuada tempus dolor dolor magna consectetur. Nisl dui non curabitur laoreet tortor.
""" - return expand_all(example) - + return expand_html(example) if __name__=="__main__": if len(sys.argv)>1: - print expand_all(open(sys.argv[1]).read()) + print expand_html(open(sys.argv[1]).read()) else: print test()