auth.wiki(render='html')

This commit is contained in:
mdipierro
2012-09-08 22:22:06 -05:00
parent bbaee04f28
commit 22fbf70aae
3 changed files with 39 additions and 18 deletions
+12
View File
@@ -31,6 +31,8 @@ from utils import web2py_uuid
from fileutils import read_file, check_credentials
from gluon import *
from gluon.contrib.autolinks import expand_one
from gluon.contrib.markmin.markmin2html import \
replace_at_urls, replace_autolinks, replace_components
from gluon.dal import Row
import serializers
@@ -4486,6 +4488,15 @@ class Wiki(object):
*[A(t.strip(),_href=URL(args='_search',vars=dict(q=t)))
for t in page.tags or [] if t.strip()]).xml()
return html
def html_render(self,page):
html = page.body
# @///function -> http://..../function
html = replace_at_urls(html,URL)
# http://...jpg -> <img src="http://...jpg/> or oembed
html = replace_autolinks(html,lambda link: expand_one(link,{}))
# @{component:name} -> <script>embed component name</script>
html = replace_components(html,self.env)
return html
@staticmethod
def component(text):
"""
@@ -4500,6 +4511,7 @@ class Wiki(object):
self.env = env or {}
self.env['component'] = Wiki.component
if render == 'markmin': render=self.markmin_render
elif render == 'html': render=self.html_render
self.auth = auth
if self.auth.user:
self.force_prefix = force_prefix % self.auth.user