MARKMIN(...,_class='...')
This commit is contained in:
1 parent
0e95fba28d
commit
200a953849
2 files changed
+37
-19
No files matched your search
@@ -1 +1 @@
|
|||||||
Version 2.8.2-stable+timestamp.2014.01.11.15.18.53
|
Version 2.8.2-stable+timestamp.2014.01.11.15.31.09
|
||||||
+36
-18
@@ -2694,27 +2694,45 @@ def markmin_serializer(text, tag=None, attr=None):
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
def MARKMIN(text, extra=None, allowed=None, sep='p',
|
class MARKMIN(XmlComponent):
|
||||||
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
|
||||||
"""
|
"""
|
||||||
from gluon.contrib.markmin.markmin2html import render
|
def __init__(self,
|
||||||
extra = extra or {}
|
text, extra=None, allowed=None, sep='p',
|
||||||
allowed = allowed or {}
|
url=None, environment=None, latex='google',
|
||||||
url = URL if url == True else url
|
autolinks='default',
|
||||||
text = render(text, extra=extra,
|
protolinks='default',
|
||||||
allowed=allowed, sep=sep, latex=latex,
|
class_prefix='',
|
||||||
URL=url, environment=environment,
|
id_prefix='markmin_',
|
||||||
autolinks=autolinks, protolinks=protolinks,
|
**kwargs):
|
||||||
class_prefix=class_prefix, id_prefix=id_prefix)
|
self.text = text
|
||||||
html = XML(text or '')
|
self.extra = extra or {}
|
||||||
return XML(html) if not kwargs else DIV(html,**kwargs)
|
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
|
||||||
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
def flatten(self):
|
||||||
|
return self.text
|
||||||
|
|
||||||
|
def xml(self):
|
||||||
|
from gluon.contrib.markmin.markmin2html import render
|
||||||
|
html = 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)
|
||||||
|
return html if not self.kwargs else DIV(XML(html), **self.kwargs).xml()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.xml()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
|
|||||||
Reference in new issue
Block a user