MARKMIN(...,_class='...')

This commit is contained in:
mdipierro
2014-01-11 15:19:38 -06:00
parent 907525efd7
commit 0e95fba28d
2 changed files with 19 additions and 47 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.8.2-stable+timestamp.2014.01.11.15.02.21 Version 2.8.2-stable+timestamp.2014.01.11.15.18.53
+14 -42
View File
@@ -2694,55 +2694,27 @@ def markmin_serializer(text, tag=None, attr=None):
return text return text
class MARKMIN(XmlComponent): def MARKMIN(text, extra=None, allowed=None, sep='p',
"""
For documentation: http://web2py.com/examples/static/markmin.html
"""
def __init__(self, text, extra=None, allowed=None, sep='p',
url=None, environment=None, latex='google', url=None, environment=None, latex='google',
autolinks='default', autolinks='default',
protolinks='default', protolinks='default',
class_prefix='', class_prefix='',
id_prefix='markmin_'): id_prefix='markmin_',
self.text = text **kwargs):
self.extra = extra or {}
self.allowed = allowed or {}
self.sep = sep
self.url = URL if url == True else url
self.environment = environment
self.latex = latex
self.autolinks = autolinks
self.protolinks = protolinks
self.class_prefix = class_prefix
self.id_prefix = id_prefix
def xml(self):
""" """
calls the gluon.contrib.markmin render function to convert the wiki syntax For documentation: http://web2py.com/examples/static/markmin.html
""" """
from gluon.contrib.markmin.markmin2html import render from gluon.contrib.markmin.markmin2html import render
return render(self.text, extra=self.extra, extra = extra or {}
allowed=self.allowed, sep=self.sep, latex=self.latex, allowed = allowed or {}
URL=self.url, environment=self.environment, url = URL if url == True else url
autolinks=self.autolinks, protolinks=self.protolinks, text = render(text, extra=extra,
class_prefix=self.class_prefix, id_prefix=self.id_prefix) allowed=allowed, sep=sep, latex=latex,
URL=url, environment=environment,
def __str__(self): autolinks=autolinks, protolinks=protolinks,
return self.xml() class_prefix=class_prefix, id_prefix=id_prefix)
html = XML(text or '')
def flatten(self, render=None): return XML(html) if not kwargs else DIV(html,**kwargs)
"""
return the text stored by the MARKMIN object rendered by the render function
"""
return self.text
def elements(self, *args, **kargs):
"""
to be considered experimental since the behavior of this method is questionable
another options could be TAG(self.text).elements(*args,**kargs)
"""
return [self.text]
if __name__ == '__main__': if __name__ == '__main__':
import doctest import doctest