MARKMIN(...,_class='...')
This commit is contained in:
@@ -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
|
||||||
|
|||||||
+18
-46
@@ -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',
|
||||||
|
url=None, environment=None, latex='google',
|
||||||
|
autolinks='default',
|
||||||
|
protolinks='default',
|
||||||
|
class_prefix='',
|
||||||
|
id_prefix='markmin_',
|
||||||
|
**kwargs):
|
||||||
"""
|
"""
|
||||||
For documentation: http://web2py.com/examples/static/markmin.html
|
For documentation: http://web2py.com/examples/static/markmin.html
|
||||||
"""
|
"""
|
||||||
def __init__(self, text, extra=None, allowed=None, sep='p',
|
from gluon.contrib.markmin.markmin2html import render
|
||||||
url=None, environment=None, latex='google',
|
extra = extra or {}
|
||||||
autolinks='default',
|
allowed = allowed or {}
|
||||||
protolinks='default',
|
url = URL if url == True else url
|
||||||
class_prefix='',
|
text = render(text, extra=extra,
|
||||||
id_prefix='markmin_'):
|
allowed=allowed, sep=sep, latex=latex,
|
||||||
self.text = text
|
URL=url, environment=environment,
|
||||||
self.extra = extra or {}
|
autolinks=autolinks, protolinks=protolinks,
|
||||||
self.allowed = allowed or {}
|
class_prefix=class_prefix, id_prefix=id_prefix)
|
||||||
self.sep = sep
|
html = XML(text or '')
|
||||||
self.url = URL if url == True else url
|
return XML(html) if not kwargs else DIV(html,**kwargs)
|
||||||
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
|
|
||||||
"""
|
|
||||||
from gluon.contrib.markmin.markmin2html import render
|
|
||||||
return render(self.text, extra=self.extra,
|
|
||||||
allowed=self.allowed, sep=self.sep, latex=self.latex,
|
|
||||||
URL=self.url, environment=self.environment,
|
|
||||||
autolinks=self.autolinks, protolinks=self.protolinks,
|
|
||||||
class_prefix=self.class_prefix, id_prefix=self.id_prefix)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.xml()
|
|
||||||
|
|
||||||
def flatten(self, render=None):
|
|
||||||
"""
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user